Enum BackendTensor
pub enum BackendTensor<B>where
B: BackendTypes,{
Float(<B as BackendTypes>::FloatTensorPrimitive),
Int(<B as BackendTypes>::IntTensorPrimitive),
Bool(<B as BackendTypes>::BoolTensorPrimitive),
Quantized(<B as BackendTypes>::QuantizedTensorPrimitive),
Autodiff(<Autodiff<B> as BackendTypes>::FloatTensorPrimitive),
}Expand description
Tensor which points to a backend tensor primitive kind.
Variants§
Float(<B as BackendTypes>::FloatTensorPrimitive)
Float tensor handle.
Int(<B as BackendTypes>::IntTensorPrimitive)
Int tensor handle.
Bool(<B as BackendTypes>::BoolTensorPrimitive)
Bool tensor handle.
Quantized(<B as BackendTypes>::QuantizedTensorPrimitive)
Quantized tensor handle.
Autodiff(<Autodiff<B> as BackendTypes>::FloatTensorPrimitive)
Autodiff float tensor handle.
Implementations§
§impl<B> BackendTensor<B>where
B: Backend,
impl<B> BackendTensor<B>where
B: Backend,
pub fn float(self) -> <B as BackendTypes>::FloatTensorPrimitive
pub fn float(self) -> <B as BackendTypes>::FloatTensorPrimitive
Returns the inner float tensor primitive.
pub fn as_float(&self) -> &<B as BackendTypes>::FloatTensorPrimitive
pub fn as_float(&self) -> &<B as BackendTypes>::FloatTensorPrimitive
Returns the inner float tensor primitive.
pub fn int(self) -> <B as BackendTypes>::IntTensorPrimitive
pub fn int(self) -> <B as BackendTypes>::IntTensorPrimitive
Returns the inner int tensor primitive.
pub fn bool(self) -> <B as BackendTypes>::BoolTensorPrimitive
pub fn bool(self) -> <B as BackendTypes>::BoolTensorPrimitive
Returns the inner bool tensor primitive.
pub fn quantized(self) -> <B as BackendTypes>::QuantizedTensorPrimitive
pub fn quantized(self) -> <B as BackendTypes>::QuantizedTensorPrimitive
Returns the inner quantized tensor primitive.
pub fn autodiff(self) -> <Autodiff<B> as BackendTypes>::FloatTensorPrimitive
pub fn autodiff(self) -> <Autodiff<B> as BackendTypes>::FloatTensorPrimitive
Returns the inner autodiff tensor primitive.
pub fn as_autodiff(
&self,
) -> &<Autodiff<B> as BackendTypes>::FloatTensorPrimitive
pub fn as_autodiff( &self, ) -> &<Autodiff<B> as BackendTypes>::FloatTensorPrimitive
Returns the inner autodiff tensor primitive.
pub fn autodiff_inner(self) -> <B as BackendTypes>::FloatTensorPrimitive
pub fn autodiff_inner(self) -> <B as BackendTypes>::FloatTensorPrimitive
Returns the inner autodiff tensor primitive.
pub fn into_autodiff(self) -> BackendTensor<Autodiff<B>>
pub fn into_autodiff(self) -> BackendTensor<Autodiff<B>>
Lift a handle for backend B into the equivalent handle for Autodiff<B>.
An already-tracked float (Autodiff) becomes the Float handle of Autodiff<B>; int/bool/
quantized handles are re-tagged unchanged (those primitives are shared between B and
Autodiff<B>). An untracked Float handle is invalid here (under autodiff, float tensors
arrive tracked), so it panics.
Trait Implementations§
§impl<B> Clone for BackendTensor<B>where
B: Clone + BackendTypes,
<B as BackendTypes>::FloatTensorPrimitive: Clone,
<B as BackendTypes>::IntTensorPrimitive: Clone,
<B as BackendTypes>::BoolTensorPrimitive: Clone,
<B as BackendTypes>::QuantizedTensorPrimitive: Clone,
impl<B> Clone for BackendTensor<B>where
B: Clone + BackendTypes,
<B as BackendTypes>::FloatTensorPrimitive: Clone,
<B as BackendTypes>::IntTensorPrimitive: Clone,
<B as BackendTypes>::BoolTensorPrimitive: Clone,
<B as BackendTypes>::QuantizedTensorPrimitive: Clone,
§fn clone(&self) -> BackendTensor<B>
fn clone(&self) -> BackendTensor<B>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<B> Debug for BackendTensor<B>where
B: Debug + BackendTypes,
<B as BackendTypes>::FloatTensorPrimitive: Debug,
<B as BackendTypes>::IntTensorPrimitive: Debug,
<B as BackendTypes>::BoolTensorPrimitive: Debug,
<B as BackendTypes>::QuantizedTensorPrimitive: Debug,
impl<B> Debug for BackendTensor<B>where
B: Debug + BackendTypes,
<B as BackendTypes>::FloatTensorPrimitive: Debug,
<B as BackendTypes>::IntTensorPrimitive: Debug,
<B as BackendTypes>::BoolTensorPrimitive: Debug,
<B as BackendTypes>::QuantizedTensorPrimitive: Debug,
§impl<B> TensorMetadata for BackendTensor<B>where
B: BackendTypes,
impl<B> TensorMetadata for BackendTensor<B>where
B: BackendTypes,
§type Device = <B as BackendTypes>::Device
type Device = <B as BackendTypes>::Device
§fn device(&self) -> <BackendTensor<B> as TensorMetadata>::Device
fn device(&self) -> <BackendTensor<B> as TensorMetadata>::Device
§fn can_mut(&self) -> bool
fn can_mut(&self) -> bool
slice_assign, an inplace kernel)
writes the existing allocation instead of copying it first. Read more§fn scheme(&self) -> QuantScheme
fn scheme(&self) -> QuantScheme
Auto Trait Implementations§
impl<B> !RefUnwindSafe for BackendTensor<B>
impl<B> !UnwindSafe for BackendTensor<B>
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> 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,
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
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,
§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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