mindsponge.common.vecs_dot_vecs

View Source On Gitee
mindsponge.common.vecs_dot_vecs(v1, v2)[source]

Dot product of vectors \(v_1 = (x_1, x_2, x_3)\) and \(v_2 = (y_1, y_2, y_3)\).

\[res = x_1 * y_1 + x_2 * y_2 + x_3 * y_3\]
Parameters
  • v1 (tuple) – vectors \(\vec v_1\) , length is 3. Data type is constant or Tensor with same shape.

  • v2 (tuple) – vectors \(\vec v_2\) , length is 3. Data type is constant or Tensor with same shape.

Returns

float or Tensor with the same shape as the Tensor in input, dot product result of two vectors .

Supported Platforms:

Ascend GPU

Examples

>>> import mindsponge
>>> v1 = (1, 2, 3)
>>> v2 = (3, 4, 5)
>>> ans = mindsponge.common.vecs_dot_vecs(v1, v2)
>>> print(ans)
26