mindspore.ops.vecdot

View Source On Gitee
mindspore.ops.vecdot(x, y, *, axis=- 1)[source]

Calculates the dot product of two batches of vectors along the specified dimension.

Support broadcasting.

The formula of calculation is as follows. xi¯ represents the conjugate for complex vectors, and xi¯ is the raw value for real vectors.

i=1nxi¯yi

Warning

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

Parameters
  • x (Tensor) – The first batch of tensors.

  • y (Tensor) – The second batch of tensors.

Keyword Arguments

axis (int) – Specify the axis for computation. Default -1 .

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Note

Currently, complex numbers are not supported on GPU.

Examples

>>> import mindspore
>>> x = mindspore.tensor([[1, 3], [5, 7], [9, 8]])
>>> y = mindspore.tensor([[4, 5], [6, 7], [3, 2]])
>>> mindspore.ops.vecdot(x, y)
Tensor(shape=[3], dtype=Int64, value= [19, 79, 43])
>>> mindspore.ops.vecdot(x, y, axis=0)
Tensor(shape=[2], dtype=Int64, value= [61, 80])