Function outer

pub fn outer<B, const D: usize, const R: usize, K>(
    x: Tensor<B, D, K>,
    y: Tensor<B, D, K>,
) -> Tensor<B, R, K>
where B: Backend, K: BasicOps<B> + Numeric<B>,
Expand description

Computes the outer product (and batched outer product) for rank-1 or rank-2 tensor.

Supported ranks:

  • D = 1, R = 2: vectors (m,) × (n,) → (m, n)
  • D = 2, R = 3: batched (b, m) × (b, n) → (b, m, n)

Panics:

  • if D > 2
  • if (D, R) is not (1,2) or (2,3)
  • if D = 2 and batch dimensions differ