mr2.utils.dot

mr2.utils.dot(a: Tensor | Sequence[Tensor], b: Tensor | Sequence[Tensor]) → Tensor[source]

Compute the inner product of tensors or sequences of tensors.

Computes \(\sum_i \overline{a_i} b_i\), conjugating the first input. Corresponding tensors must have the same number of elements, dtype and device. Sequences are treated as concatenated vectors without allocating the concatenation. They must have the same length; empty sequences return a scalar zero on CPU. Uses torch.vdot for at most 2**31 - 1 elements. Larger inputs are reduced in chunks to avoid inaccurate CPU reductions and CUDA size limits. Computation and output use the input dtype. Derivatives are computed analytically to bound memory.

Parameters:
Returns:

torch.Tensor – Scalar inner product.