Skip to main content

stack

Function stack 

Source
pub fn stack<T: Scalar, B: ComputeBackend + Default>(
    tensors: &[&Tensor<T, B>],
    dim: usize,
) -> Result<Tensor<T, B>, B::Error>
Expand description

Stack tensors along a new dimension dim.

All tensors must have identical shape. dim may be any axis in 0..=tensors[0].ndim().

ยงPanics

  • tensors is empty.
  • Any tensor shape differs from the first tensor.
  • dim is outside 0..=ndim.