qml.math.dot¶
- dot(tensor1, tensor2, like=None)[source]¶
Returns the matrix or dot product of two tensors.
If either tensor is 0-dimensional, elementwise multiplication is performed and a 0-dimensional scalar or a tensor with the same dimensions as the other tensor is returned.
If both tensors are 1-dimensional, the dot product is returned.
If the first array is 2-dimensional and the second array 1-dimensional, the matrix-vector product is returned.
If both tensors are 2-dimensional, the matrix product is returned.
Finally, if the first array is N-dimensional and the second array M-dimensional, a sum product over the last dimension of the first array, and the second-to-last dimension of the second array is returned.
- Parameters
tensor1 (tensor_like) – input tensor
tensor2 (tensor_like) – input tensor
- Returns
the matrix or dot product of two tensors
- Return type
tensor_like