Skip to main content

slice_flat

Function slice_flat 

Source
pub fn slice_flat(tensor: &Tensor, start: usize, end: usize) -> Result<Tensor>
Expand description

Extracts [start, end) of a tensor’s flattened data as a genuinely smaller 1-D tensor.

The whole point of ZeRO is that a rank only retains its own slice, so this really allocates end - start elements rather than rescaling the original. (The source tensor is read in full here because partitioning happens once, at setup, from a materialised parameter map.)

§Errors

Returns an error when the range is out of bounds or the tensor is not f32-readable.