pub trait Dataset {
// Required methods
fn len(&self) -> i64;
fn get_item(&self, index: i64) -> Result<Matrix>;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn get_sample(&self, index: i64) -> Result<Sample> { ... }
fn get_batch(&self, indices: &[i64]) -> Result<Batch> { ... }
fn subset(&self, indices: Vec<i64>) -> Result<Subset<'_>>
where Self: Sized { ... }
fn shuffled_subset(&self, seed: u64) -> Result<Subset<'_>>
where Self: Sized { ... }
}Expand description
Object-safe dataset contract: indexed access and a total count.
Corresponds to the C++ pure-virtual oa::Dataset base class.
Required Methods§
Provided Methods§
Sourcefn get_sample(&self, index: i64) -> Result<Sample>
fn get_sample(&self, index: i64) -> Result<Sample>
Retrieve one sample by index.
The default implementation wraps Dataset::get_item for single-output
datasets. Override to return a labeled sample.
Sourcefn subset(&self, indices: Vec<i64>) -> Result<Subset<'_>>where
Self: Sized,
fn subset(&self, indices: Vec<i64>) -> Result<Subset<'_>>where
Self: Sized,
Return a zero-copy indexed view over this dataset.
Corresponds to oa::DsSubset.
§Errors
Returns an error for a negative parent length or an out-of-range index.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".