pub struct Tensor { /* private fields */ }Expand description
A device buffer with shape and element type: an input to or output from
Context::invoke.
Implementations§
Source§impl Tensor
impl Tensor
Sourcepub fn from_f32(device: &Device, shape: &[usize], data: &[f32]) -> Result<Self>
pub fn from_f32(device: &Device, shape: &[usize], data: &[f32]) -> Result<Self>
Allocate a device-local f32 buffer view, copying data in.
Sourcepub fn from_u8(device: &Device, shape: &[usize], data: &[u8]) -> Result<Self>
pub fn from_u8(device: &Device, shape: &[usize], data: &[u8]) -> Result<Self>
Allocate a device-local u8 buffer view, copying data in (e.g. an
int8/uint8 quantized model input).
Trait Implementations§
Auto Trait Implementations§
impl !Send for Tensor
impl !Sync for Tensor
impl Freeze for Tensor
impl RefUnwindSafe for Tensor
impl Unpin for Tensor
impl UnsafeUnpin for Tensor
impl UnwindSafe for Tensor
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