# pytaco.dot

pytaco.dot(t1, t2, out_format=mode_format(compressed), dtype=None)

The dot product of two tensors.

This implements the same spec as NumPy but allows for sparse taco tensors as operands.

• If both t1 and t2 are 1-D then this is an inner product.

• If either operand is a scalar, this is equivalent to element-wise multiply.

• Equivalent to matrix multiplication if both tensors are 2-D

• If t1 is N-D and t2 is 1-D,t is a sum product over the last axis of t1 and t2

• if t1 is an N-D array and t2 is an M-D array (where M>=2), it is a sum product over the last axis of t1 and the second-to-last axis of t2:

We could write this using index expressions for two 3-D tensors as: `T[i, j, k, m] = t1[i, j, l] * t2[k, l, m]`

In the above, T = dot(t1, t2)

Parameters
t1, t2: tensors, array_like

The arguments to dot. The side of the last dimension of t1 must be equal to the size of the second to last dimension of t2.

out_format: format, mode_format, optional
dtype: Datatype

The datatype of the output tensor.

Returns
res: tensor

The dot product of the input tensors.

Examples

```>>> import pytaco as pt
>>> pt.dot(3, 4)[0]
12.0
>>> a = [[1, 0], [0, 1]]
>>> b = [[4, 1], [2, 2]]
>>> pt.dot(a, b).to_array()
array([[4, 1],
[2, 2]], dtype=int64)
```