Skip to main content

HostTensorDataset

Struct HostTensorDataset 

Source
pub struct HostTensorDataset { /* private fields */ }
Expand description

Dense labeled feature/label pair implementing HostDataset.

x is a rank-≥1 [N, ...] host tensor and y a [N] label vector with the same leading count and dtype class as collate_host accepts. get_host_sample slices along the leading axis.

Implementations§

Source§

impl HostTensorDataset

Source

pub fn new(x: HostTensor, y: HostTensor) -> Result<Self>

Wrap caller-owned host tensors as a labeled dataset.

§Errors

Returns an error for a rank-0 feature tensor, non-vector labels, or mismatched leading counts.

Source

pub fn from_f32_matrices(x: &Matrix, y: &Matrix) -> Result<Self>

Materialize a host mirror of F32 device matrices.

Reads x and y back once on the calling thread; afterwards the dataset is pure host data that prefetch workers may index without touching the runtime.

§Errors

Returns an error for a rank-0 feature matrix, non-vector labels, mismatched leading counts, or a failed readback.

Trait Implementations§

Source§

impl HostDataset for HostTensorDataset

Source§

fn len(&self) -> i64

Total number of items in the dataset.
Source§

fn get_host_sample(&self, index: i64) -> Result<HostSample>

Retrieve one host sample by index. Read more
Source§

fn is_empty(&self) -> bool

Return true when the dataset contains no items.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.