mindspore.mint.dot

View Source On Gitee
mindspore.mint.dot(input, other)[source]

Computes the dot product of two 1D tensor.

Warning

This is an experimental API that is subject to change or deletion.

Parameters
  • input (Tensor) – The first input in the dot product, must be 1D.

  • other (Tensor) – The second input in the dot product, must be 1D.

Returns

Tensor, the shape is [] and the data type is same as input.

Raises
  • TypeError – If dtype of input, other is not tensor.

  • TypeError – If dtype of input, other are not in float16, float32 or bfloat16.

  • RuntimeError – If dtypes of input and other are not same.

  • RuntimeError – If shapes of input and other are not same.

  • RuntimeError – If shapes of input and other are not 1D.

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> from mindspore import Tensor, mint
>>> x = Tensor([2.0, 3.0], mindspore.float32)
>>> y = Tensor([2.0, 1.0], mindspore.float32)
>>> dot = mint.dot()
>>> output = dot(x, y)
>>> print(output)
[7.        ]
>>> print(output.dtype)
Float32