pub struct HostTensor<T: Prm> { /* private fields */ }
Expand description
Tensor structure. It consists of a contiguous one-dimensional array and a shape. Tensor tries to reuse resources as long as possible and implements copy-on-write mechanism.
Implementations§
Source§impl<T: Prm> HostTensor<T>
impl<T: Prm> HostTensor<T>
Sourcepub unsafe fn new_uninit(shape: &Shape) -> Self
pub unsafe fn new_uninit(shape: &Shape) -> Self
Create unitialized tensor
Sourcepub fn new_filled(shape: &Shape, value: T) -> Self
pub fn new_filled(shape: &Shape, value: T) -> Self
Create tensor filled with value on the specified hardware
Sourcepub fn new_zeroed(shape: &Shape) -> Self
pub fn new_zeroed(shape: &Shape) -> Self
Create tensor filled with zeros on the specified hardware
Sourcepub fn iter<'a>(&'a self) -> HostTensorIter<'a, T> ⓘ
pub fn iter<'a>(&'a self) -> HostTensorIter<'a, T> ⓘ
Iterator over flatten tensor.
Sourcepub fn iter_mut<'a>(&'a mut self) -> HostTensorIterMut<'a, T>
pub fn iter_mut<'a>(&'a mut self) -> HostTensorIterMut<'a, T>
Mutable iterator over flatten tensor.
Trait Implementations§
Source§impl<T: Prm> Tensor<T> for HostTensor<T>
impl<T: Prm> Tensor<T> for HostTensor<T>
Source§type Buffer = HostBuffer<T>
type Buffer = HostBuffer<T>
Inner buffer type.
Source§unsafe fn new_uninit_in(_: &(), shape: &Shape) -> Self
unsafe fn new_uninit_in(_: &(), shape: &Shape) -> Self
Create unitialized tensor
Source§fn new_filled_in(_: &(), shape: &Shape, value: T) -> Self
fn new_filled_in(_: &(), shape: &Shape, value: T) -> Self
Create tensor filled with value on the specified hardware
Source§fn new_zeroed_in(_: &(), shape: &Shape) -> Self
fn new_zeroed_in(_: &(), shape: &Shape) -> Self
Create tensor filled with zeros on the specified hardware
Auto Trait Implementations§
impl<T> Freeze for HostTensor<T>
impl<T> RefUnwindSafe for HostTensor<T>where
T: RefUnwindSafe,
impl<T> !Send for HostTensor<T>
impl<T> !Sync for HostTensor<T>
impl<T> Unpin for HostTensor<T>where
T: Unpin,
impl<T> UnwindSafe for HostTensor<T>where
T: UnwindSafe + RefUnwindSafe,
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