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
impl HostTensorDataset
Sourcepub fn new(x: HostTensor, y: HostTensor) -> Result<Self>
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.
Sourcepub fn from_f32_matrices(x: &Matrix, y: &Matrix) -> Result<Self>
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
impl HostDataset for HostTensorDataset
Auto Trait Implementations§
impl Forget for HostTensorDataset
impl Freeze for HostTensorDatasetwhere
*const u8 is !null: Freeze,
PhantomData<usize>: Freeze,
PhantomData<f32>: Freeze,
PhantomData<u32>: Freeze,
PhantomData<i32>: Freeze,
PhantomData<u8>: Freeze,
impl Move for HostTensorDataset
impl RefUnwindSafe for HostTensorDataset
impl Send for HostTensorDatasetwhere
RawVecInner: Send,
impl Sync for HostTensorDatasetwhere
RawVecInner: Sync,
impl Unpin for HostTensorDataset
impl UnsafeUnpin for HostTensorDatasetwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
PhantomData<f32>: UnsafeUnpin,
PhantomData<u32>: UnsafeUnpin,
PhantomData<i32>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for HostTensorDatasetwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more