megengine.functional.dot

dot(inp1, inp2)[source]

Computes dot-product of two vectors inp1 and inp2. inputs must be 1-dimensional or scalar. A scalar input is automatically broadcasted. Refer to matmul for more general usage.

Parameters
  • inp1 (Tensor) – first vector.

  • inp2 (Tensor) – second vector.

Return type

Tensor

Returns

output value.

Examples

>>> import numpy as np
>>> data1 = Tensor(np.arange(0, 6, dtype=np.float32))
>>> data2 = Tensor(np.arange(0, 6, dtype=np.float32))
>>> out = F.dot(data1, data2)
>>> out.numpy()
array(55., dtype=float32)