pub struct Tensor { /* private fields */ }Expand description
GPU tensor with shape metadata. Wraps a GpuBuffer. Shape is stored inline (max 6 dims covers batch x channel x D x H x W + extra).
Implementations§
Source§impl Tensor
impl Tensor
Sourcepub fn new(dev: &GpuDevice, data: &[f32], shape: &[u32]) -> Result<Self>
pub fn new(dev: &GpuDevice, data: &[f32], shape: &[u32]) -> Result<Self>
Create a tensor from data with the given shape.
Sourcepub fn from_buf(buf: GpuBuffer, shape: &[u32]) -> Result<Self>
pub fn from_buf(buf: GpuBuffer, shape: &[u32]) -> Result<Self>
Create a tensor from an existing GpuBuffer with the given shape.
Sourcepub fn zeros(dev: &GpuDevice, shape: &[u32]) -> Result<Self>
pub fn zeros(dev: &GpuDevice, shape: &[u32]) -> Result<Self>
Create a zero tensor with the given shape.
Auto Trait Implementations§
impl Freeze for Tensor
impl !RefUnwindSafe for Tensor
impl Send for Tensor
impl Sync 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