Skip to content
fn

dot

→Tensor
dot(x: Tensor, y: Tensor)

Implementing kernel

C++ engine symbols that back this Python API.

Dot product of two 1-D tensors.

Computes the scalar inner product

x⋅y = ∑ixi yi.x \cdot y \,=\, \sum_{i} x_i\, y_i.

Parameters

1-D tensors of equal length.
1-D tensors of equal length.

Returns

Tensor

Scalar dot product.

Notes

Any other rank is refused with a ShapeMismatch (a RuntimeError); inner, vecdot and matmul take those.

Examples

>>> import lucid
>>> from lucid.linalg import dot
>>> dot(lucid.tensor([1.0, 2.0, 3.0]), lucid.tensor([4.0, 5.0, 6.0]))
tensor(32.)