mindspore.ops.dot

mindspore.ops.dot(x1, x2)[source]

Computation a dot product between samples in two tensors.

Inputs:
  • x1 (Tensor) - First tensor in Dot op with datatype float16 or float32

  • x2 (Tensor) - Second tensor in Dot op with datatype float16 or float32

Outputs:

Tensor, dot product of x1 and x2.

Raises
  • TypeError – If type of x1 and x2 are not the same.

  • TypeError – If dtype of x1 or x2 is not float16 or float32.

  • ValueError – If rank of x1 or x2 less than 2.

Supported Platforms:

Ascend GPU CPU

Examples

>>> input_x1 = Tensor(np.ones(shape=[2, 3]), mindspore.float32)
>>> input_x2 = Tensor(np.ones(shape=[1, 3, 2]), mindspore.float32)
>>> output = C.dot(input_x1, input_x2)
>>> print(output)
[[[3. 3.]]
 [[3. 3.]]]