pub struct HostTensor {
pub shape: Vec<usize>,
pub values: HostValues,
}Expand description
A dense tensor living in host memory.
Shape semantics match Matrix: num_elements is the shape product and
shape[0] is the leading (sample or batch) dimension.
Fields§
§shape: Vec<usize>Logical shape.
values: HostValuesElement values in row-major order.
Implementations§
Source§impl HostTensor
impl HostTensor
Sourcepub fn new(shape: impl Into<Vec<usize>>, values: HostValues) -> Result<Self>
pub fn new(shape: impl Into<Vec<usize>>, values: HostValues) -> Result<Self>
Construct a host tensor, checking the element count against the shape.
§Errors
Returns an error when the shape product overflows or differs from the value count.
Sourcepub fn num_elements(&self) -> usize
pub fn num_elements(&self) -> usize
Element count implied by the shape.
Trait Implementations§
Source§impl Clone for HostTensor
impl Clone for HostTensor
Auto Trait Implementations§
impl Forget for HostTensor
impl Freeze for HostTensorwhere
*const u8 is !null: Freeze,
PhantomData<usize>: Freeze,
PhantomData<f32>: Freeze,
PhantomData<u32>: Freeze,
PhantomData<i32>: Freeze,
PhantomData<u8>: Freeze,
impl Move for HostTensor
impl RefUnwindSafe for HostTensor
impl Send for HostTensorwhere
RawVecInner: Send,
impl Sync for HostTensorwhere
RawVecInner: Sync,
impl Unpin for HostTensor
impl UnsafeUnpin for HostTensorwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
PhantomData<f32>: UnsafeUnpin,
PhantomData<u32>: UnsafeUnpin,
PhantomData<i32>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for HostTensorwhere
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