mindspore.ops.tensor_dot
- mindspore.ops.tensor_dot(x1, x2, axes)[source]
Compute the tensor dot product along the specified axes.
- Parameters
x1 (Tensor) – Input tensor.
x2 (Tensor) – Input tensor.
axes (Union[int, tuple(int), tuple(tuple(int)), list(list(int))]) – The number of dimensions to sum over. If an integer k is provided, then sum over the last k axes of x1 and the first k axes of x2, in order. If a tuple or list is provided, then axes[0] specifies the axes of x1 and axes[1] specifies the axes of x2.
- Returns
Tensor.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> from mindspore import Tensor, ops >>> import mindspore >>> import numpy as np >>> input_x1 = Tensor(np.ones(shape=[1, 2, 3]), mindspore.float32) >>> input_x2 = Tensor(np.ones(shape=[3, 1, 2]), mindspore.float32) >>> output = ops.tensor_dot(input_x1, input_x2, ((0,1),(1,2))) >>> print(output) [[2. 2. 2] [2. 2. 2] [2. 2. 2]]