pub enum BackendTensor<B: BackendTypes> {
Float(B::FloatTensorPrimitive),
Int(B::IntTensorPrimitive),
Bool(B::BoolTensorPrimitive),
Quantized(B::QuantizedTensorPrimitive),
}Expand description
Tensor which points to a backend tensor primitive kind.
Variants§
Float(B::FloatTensorPrimitive)
Float tensor handle.
Int(B::IntTensorPrimitive)
Int tensor handle.
Bool(B::BoolTensorPrimitive)
Bool tensor handle.
Quantized(B::QuantizedTensorPrimitive)
Quantized tensor handle.
Implementations§
Source§impl<B: Backend> BackendTensor<B>
impl<B: Backend> BackendTensor<B>
Sourcepub fn float(self) -> B::FloatTensorPrimitive
pub fn float(self) -> B::FloatTensorPrimitive
Returns the inner float tensor primitive.
Sourcepub fn as_float(&self) -> &B::FloatTensorPrimitive
pub fn as_float(&self) -> &B::FloatTensorPrimitive
Returns the inner float tensor primitive.
Sourcepub fn int(self) -> B::IntTensorPrimitive
pub fn int(self) -> B::IntTensorPrimitive
Returns the inner int tensor primitive.
Sourcepub fn bool(self) -> B::BoolTensorPrimitive
pub fn bool(self) -> B::BoolTensorPrimitive
Returns the inner bool tensor primitive.
Sourcepub fn quantized(self) -> B::QuantizedTensorPrimitive
pub fn quantized(self) -> B::QuantizedTensorPrimitive
Returns the inner quantized tensor primitive.
Trait Implementations§
Source§impl<B: Clone + BackendTypes> Clone for BackendTensor<B>where
B::FloatTensorPrimitive: Clone,
B::IntTensorPrimitive: Clone,
B::BoolTensorPrimitive: Clone,
B::QuantizedTensorPrimitive: Clone,
impl<B: Clone + BackendTypes> Clone for BackendTensor<B>where
B::FloatTensorPrimitive: Clone,
B::IntTensorPrimitive: Clone,
B::BoolTensorPrimitive: Clone,
B::QuantizedTensorPrimitive: Clone,
Source§fn clone(&self) -> BackendTensor<B>
fn clone(&self) -> BackendTensor<B>
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 moreSource§impl<B: Debug + BackendTypes> Debug for BackendTensor<B>where
B::FloatTensorPrimitive: Debug,
B::IntTensorPrimitive: Debug,
B::BoolTensorPrimitive: Debug,
B::QuantizedTensorPrimitive: Debug,
impl<B: Debug + BackendTypes> Debug for BackendTensor<B>where
B::FloatTensorPrimitive: Debug,
B::IntTensorPrimitive: Debug,
B::BoolTensorPrimitive: Debug,
B::QuantizedTensorPrimitive: Debug,
Source§impl<B: BackendTypes> TensorMetadata for BackendTensor<B>
impl<B: BackendTypes> TensorMetadata for BackendTensor<B>
Source§type Device = <B as BackendTypes>::Device
type Device = <B as BackendTypes>::Device
The device type associated with the tensor.
Source§fn can_mut(&self) -> bool
fn can_mut(&self) -> bool
Whether the tensor’s buffer can be mutated in place — i.e. this handle
uniquely owns it, so an in-place op (
slice_assign, an inplace kernel)
writes the existing allocation instead of copying it first. Read moreSource§fn scheme(&self) -> QuantScheme
fn scheme(&self) -> QuantScheme
Get the quantization scheme for a quantized float tensor. Read more
Auto Trait Implementations§
impl<B> Freeze for BackendTensor<B>where
<B as BackendTypes>::FloatTensorPrimitive: Freeze,
<B as BackendTypes>::IntTensorPrimitive: Freeze,
<B as BackendTypes>::BoolTensorPrimitive: Freeze,
<B as BackendTypes>::QuantizedTensorPrimitive: Freeze,
impl<B> RefUnwindSafe for BackendTensor<B>where
<B as BackendTypes>::FloatTensorPrimitive: RefUnwindSafe,
<B as BackendTypes>::IntTensorPrimitive: RefUnwindSafe,
<B as BackendTypes>::BoolTensorPrimitive: RefUnwindSafe,
<B as BackendTypes>::QuantizedTensorPrimitive: RefUnwindSafe,
impl<B> Send for BackendTensor<B>
impl<B> Sync for BackendTensor<B>
impl<B> Unpin for BackendTensor<B>where
<B as BackendTypes>::FloatTensorPrimitive: Unpin,
<B as BackendTypes>::IntTensorPrimitive: Unpin,
<B as BackendTypes>::BoolTensorPrimitive: Unpin,
<B as BackendTypes>::QuantizedTensorPrimitive: Unpin,
impl<B> UnsafeUnpin for BackendTensor<B>where
<B as BackendTypes>::FloatTensorPrimitive: UnsafeUnpin,
<B as BackendTypes>::IntTensorPrimitive: UnsafeUnpin,
<B as BackendTypes>::BoolTensorPrimitive: UnsafeUnpin,
<B as BackendTypes>::QuantizedTensorPrimitive: UnsafeUnpin,
impl<B> UnwindSafe for BackendTensor<B>where
<B as BackendTypes>::FloatTensorPrimitive: UnwindSafe,
<B as BackendTypes>::IntTensorPrimitive: UnwindSafe,
<B as BackendTypes>::BoolTensorPrimitive: UnwindSafe,
<B as BackendTypes>::QuantizedTensorPrimitive: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more