Function burn::tensor::chunk

source ·
pub fn chunk<B, const D: usize, K>(
    tensor: <K as TensorKind<B>>::Primitive<D>,
    chunks: usize,
    dim: usize
) -> Vec<<K as TensorKind<B>>::Primitive<D>>
where B: Backend, K: TensorKind<B> + BasicOps<B>,
Expand description

Split the tensor along the given dimension into chunks.

§Arguments

  • tensor - The tensor.
  • chunks - The number of chunks to be produced
  • times - The dimension along which the tensor will be split.

§Returns

A vectors of tensors

§Remarks

This is a fallback solution that used only when the backend doesn’t have the corresponding implementation. Ideally, it is supposed to be implemented by the backend and the backend implementation will be resolved by static dispatch. It is not designed for direct usage by users, and not recommended to import or use this function directly.