Function meshgrid_stack

pub fn meshgrid_stack<B, const D: usize, const D2: usize, K>(
    tensors: &[Tensor<B, 1, K>; D],
    index_pos: IndexPos,
) -> Tensor<B, D2, K>
where B: Backend, K: BasicOps<B>,
Expand description

Return a coordinate matrix for a given set of 1D coordinate tensors.

Equivalent to stacking a dense matrix meshgrid, where the stack is along the first or last dimension.

§Arguments

  • tensors: A slice of 1D tensors.
  • index_pos: The position of the index in the output tensor.

§Returns

A tensor of either (N, ..., |T[i]|, ...) or (..., |T[i]|, ..., N), of coordinates, indexed on the first or last dimension.