Struct DispatchTensor
pub struct DispatchTensor {
pub kind: DispatchTensorKind,
pub autodiff: DispatchAutodiffContext,
}Expand description
A tensor that can dispatch operations to any enabled backend at runtime.
Fields§
§kind: DispatchTensorKindTensor kind primitive.
autodiff: DispatchAutodiffContextAutodiff backend association for this tensor.
Trait Implementations§
§impl Clone for DispatchTensor
impl Clone for DispatchTensor
§fn clone(&self) -> DispatchTensor
fn clone(&self) -> DispatchTensor
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 more§impl Debug for DispatchTensor
impl Debug for DispatchTensor
§impl<C> DispatchKindConversion<Autodiff<Flex, C>> for DispatchTensorwhere
C: CheckpointStrategy + IntoGradientCheckpointingStrategy,
Available on crate features autodiff and flex only.
impl<C> DispatchKindConversion<Autodiff<Flex, C>> for DispatchTensorwhere
C: CheckpointStrategy + IntoGradientCheckpointingStrategy,
Available on crate features
autodiff and flex only.§fn try_into_backend(
tensor: DispatchTensor,
) -> Result<BackendTensor<Autodiff<Flex, C>>, String>
fn try_into_backend( tensor: DispatchTensor, ) -> Result<BackendTensor<Autodiff<Flex, C>>, String>
Attempts to extract a backend-specific
BackendTensor wrapper from a generic, dynamically-routed DispatchTensor. Read more§fn from_backend(tensor: BackendTensor<Autodiff<Flex, C>>) -> DispatchTensor
fn from_backend(tensor: BackendTensor<Autodiff<Flex, C>>) -> DispatchTensor
Encapsulates a backend-specific tensor variant back into a globally routing
DispatchTensor.§impl DispatchKindConversion<Flex> for DispatchTensor
Available on crate feature flex only.
impl DispatchKindConversion<Flex> for DispatchTensor
Available on crate feature
flex only.§fn try_into_backend(
tensor: DispatchTensor,
) -> Result<BackendTensor<Flex>, String>
fn try_into_backend( tensor: DispatchTensor, ) -> Result<BackendTensor<Flex>, String>
Attempts to extract a backend-specific
BackendTensor wrapper from a generic, dynamically-routed DispatchTensor. Read more§fn from_backend(tensor: BackendTensor<Flex>) -> DispatchTensor
fn from_backend(tensor: BackendTensor<Flex>) -> DispatchTensor
Encapsulates a backend-specific tensor variant back into a globally routing
DispatchTensor.§impl From<BridgeTensor> for DispatchTensor
impl From<BridgeTensor> for DispatchTensor
§fn from(value: BridgeTensor) -> DispatchTensor
fn from(value: BridgeTensor) -> DispatchTensor
Converts to this type from the input type.
§impl TensorMetadata for DispatchTensor
impl TensorMetadata for DispatchTensor
§type Device = DispatchDevice
type Device = DispatchDevice
The device type associated with the tensor.
§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 more§fn device(&self) -> <DispatchTensor as TensorMetadata>::Device
fn device(&self) -> <DispatchTensor as TensorMetadata>::Device
Get the device associated with the tensor.
§fn scheme(&self) -> QuantScheme
fn scheme(&self) -> QuantScheme
Get the quantization scheme for a quantized float tensor. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for DispatchTensor
impl !UnwindSafe for DispatchTensor
impl Freeze for DispatchTensor
impl Send for DispatchTensor
impl Sync for DispatchTensor
impl Unpin for DispatchTensor
impl UnsafeUnpin for DispatchTensor
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,
§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
Compare self to
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>
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