pub struct CommonTensor<T: Prm, Buf: Buffer<T>> {
pub buffer: Rc<Buf>,
pub shape: Shape,
/* private fields */
}
Expand description
An intermediate structure that contains most of the Tensor functionality.
Fields§
§buffer: Rc<Buf>
§shape: Shape
Implementations§
Source§impl<T: Prm, Buf: Buffer<T>> CommonTensor<T, Buf>
impl<T: Prm, Buf: Buffer<T>> CommonTensor<T, Buf>
Create tensor from shared buffer and shape
Sourcepub fn from_buffer(buffer: Buf, shape: &Shape) -> Self
pub fn from_buffer(buffer: Buf, shape: &Shape) -> Self
Create tensor from specified buffer and shape
Sourcepub fn buffer_mut(&mut self) -> &mut Buf
pub fn buffer_mut(&mut self) -> &mut Buf
Clones inner buffer if it is shared and provides mutable access to it.
Trait Implementations§
Source§impl<T: Prm, Buf: Buffer<T>> Tensor<T> for CommonTensor<T, Buf>
impl<T: Prm, Buf: Buffer<T>> Tensor<T> for CommonTensor<T, Buf>
Source§unsafe fn new_uninit_in(context: &Buf::Context, shape: &Shape) -> Self
unsafe fn new_uninit_in(context: &Buf::Context, shape: &Shape) -> Self
Create unitialized tensor
Source§fn new_filled_in(context: &Buf::Context, shape: &Shape, value: T) -> Self
fn new_filled_in(context: &Buf::Context, shape: &Shape, value: T) -> Self
Create tensor filled with value on the specified hardware
Source§fn new_zeroed_in(context: &Buf::Context, shape: &Shape) -> Self
fn new_zeroed_in(context: &Buf::Context, shape: &Shape) -> Self
Create tensor filled with zeros on the specified hardware
Auto Trait Implementations§
impl<T, Buf> Freeze for CommonTensor<T, Buf>
impl<T, Buf> RefUnwindSafe for CommonTensor<T, Buf>where
Buf: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, Buf> !Send for CommonTensor<T, Buf>
impl<T, Buf> !Sync for CommonTensor<T, Buf>
impl<T, Buf> Unpin for CommonTensor<T, Buf>where
T: Unpin,
impl<T, Buf> UnwindSafe for CommonTensor<T, Buf>where
Buf: RefUnwindSafe,
T: 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