pub struct MatrixDataset { /* private fields */ }Expand description
Dense labeled feature/label pair implementing Dataset.
x is a rank-≥1 [N, ...] F32 feature matrix and y a [N] F32
label vector on the same engine. get_item returns the rank-(N-1)
feature slice; get_sample pairs it with the [1] label slice —
the contract DataLoader/collate expect for labeled corpora.
Dataset packs and synthetic benchmarks build their Dataset impl on
this type instead of repeating bounds, slice, and pairing logic.
Implementations§
Source§impl MatrixDataset
impl MatrixDataset
Sourcepub fn new(x: Matrix, y: Matrix) -> Result<Self>
pub fn new(x: Matrix, y: Matrix) -> Result<Self>
Wrap caller-owned matrices as a labeled dataset.
x must have a leading sample dimension and y must be rank-1
with the same leading count; both must be F32 on one engine —
matrix::slice is F32-only.
§Errors
Returns an error for a rank-0 feature matrix, non-vector labels, mismatched leading counts, non-F32 dtypes, or matrices owned by different engines.