pub struct TensorBuffer<B: Backend, T: TensorElement> { /* private fields */ }Expand description
A typed, one-dimensional collective buffer on a tensor backend.
Clones refer to the same collective state. Exported tensor primitives are snapshots: later collective writes use the backend’s copy-on-write semantics and do not modify previously exported tensors.
Implementations§
Source§impl<B: Backend, T: TensorElement> TensorBuffer<B, T>
impl<B: Backend, T: TensorElement> TensorBuffer<B, T>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn dtype(&self) -> DType
pub fn device(&self) -> &B::Device
Sourcepub fn float_tensor(&self) -> Result<B::FloatTensorPrimitive, TensorDeviceError>
pub fn float_tensor(&self) -> Result<B::FloatTensorPrimitive, TensorDeviceError>
Export the current floating tensor without a host transfer.
Sourcepub fn int_tensor(&self) -> Result<B::IntTensorPrimitive, TensorDeviceError>
pub fn int_tensor(&self) -> Result<B::IntTensorPrimitive, TensorDeviceError>
Export the current integer tensor without a host transfer.
Trait Implementations§
Source§impl<B: Clone + Backend, T: Clone + TensorElement> Clone for TensorBuffer<B, T>
impl<B: Clone + Backend, T: Clone + TensorElement> Clone for TensorBuffer<B, T>
Source§fn clone(&self) -> TensorBuffer<B, T>
fn clone(&self) -> TensorBuffer<B, T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<B, T> Freeze for TensorBuffer<B, T>where
Arc<Mutex<Option<Primitive<B>>>>: Freeze,
<B as BackendTypes>::Device: Freeze,
PhantomData<T>: Freeze,
impl<B, T> RefUnwindSafe for TensorBuffer<B, T>where
Arc<Mutex<Option<Primitive<B>>>>: RefUnwindSafe,
<B as BackendTypes>::Device: RefUnwindSafe,
PhantomData<T>: RefUnwindSafe,
impl<B, T> Send for TensorBuffer<B, T>where
Arc<Mutex<Option<Primitive<B>>>>: Send,
<B as BackendTypes>::Device: Send,
PhantomData<T>: Send,
impl<B, T> Sync for TensorBuffer<B, T>where
Arc<Mutex<Option<Primitive<B>>>>: Sync,
<B as BackendTypes>::Device: Sync,
PhantomData<T>: Sync,
impl<B, T> Unpin for TensorBuffer<B, T>where
Arc<Mutex<Option<Primitive<B>>>>: Unpin,
<B as BackendTypes>::Device: Unpin,
PhantomData<T>: Unpin,
impl<B, T> UnsafeUnpin for TensorBuffer<B, T>where
Arc<Mutex<Option<Primitive<B>>>>: UnsafeUnpin,
<B as BackendTypes>::Device: UnsafeUnpin,
PhantomData<T>: UnsafeUnpin,
impl<B, T> UnwindSafe for TensorBuffer<B, T>where
Arc<Mutex<Option<Primitive<B>>>>: UnwindSafe,
<B as BackendTypes>::Device: UnwindSafe,
PhantomData<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