Skip to main content

split_into

Function split_into 

Source
pub fn split_into<const D: usize, const N: usize>(
    t: Tensor<D>,
    sizes: [usize; N],
    dim: usize,
) -> [Tensor<D>; N]
Expand description

Like [Tensor::split_with_sizes] but returns a fixed-size array, enabling let [a, b, c, ...] = split_into::<…, N>(t, [size_a, size_b, size_c, ...], dim); destructuring at the call site instead of a fragile parts.next().unwrap() chain.

Panics if the underlying split does not produce exactly N parts (which would indicate that the requested sizes do not cover the dimension).