outer_dim

Function outer_dim 

pub fn outer_dim<B, const D: usize, const R: usize, Dim, K>(
    lhs: Tensor<B, D, K>,
    rhs: Tensor<B, D, K>,
    dim: Dim,
) -> Tensor<B, R, K>
where B: Backend, Dim: AsIndex, K: BasicOps<B> + Numeric<B>,
Expand description

Computes the outer product along a specific dimension, broadcasting over others.

For the given dim, computes the outer product of elements along that dimension, expanding it into two dimensions of size M × N at positions (dim, dim + 1).

§Arguments

  • lhs: left operand, the “row” tensor, with size M at dimension dim.
  • rhs: right operand, the “col” tensor, with size N at dimension dim.
  • dim: dimension to compute the outer product along (supports negative indexing).

§Returns

A tensor of rank R = D + 1, where:

result[..., i, j, ...] = lhs[..., i, ...] * rhs[..., j, ...]