Skip to main content

collate

Function collate 

Source
pub fn collate(samples: &[Sample]) -> Result<Batch>
Expand description

Stack samples into a leading batch dimension using device-side concatenation.

Inputs must be nonempty matrices of rank at most three, with any admitted Matrix dtype (U8, F32, I32, or U32). Labels must be present on every sample or absent on every sample. Each component must have equal shapes, dtypes, and one runtime owner. A one-sample batch reuses its Matrix storage through zero-copy views. No default Runtime or host readback is used.

ยงErrors

Returns an error for empty input, inconsistent samples, unsupported rank, allocation failure, or GPU recording failure.