Struct BridgeTensor
pub struct BridgeTensor { /* private fields */ }Expand description
A type-tagged tensor at the bridge layer between the high-level tensor API and the dispatch system.
BridgeTensor serves as the runtime representation for the public tensor
kinds (Float, Int, Bool) and internal variants like quantized floats, wrapping
the uniform DispatchTensor used by the underlying dispatch layer. This
separation keeps tensor kind tracking out of the backends while avoiding
exposure of backend-level primitives in the public API.
Implementations§
§impl BridgeTensor
impl BridgeTensor
pub fn float(tensor: DispatchTensor) -> BridgeTensor
pub fn float(tensor: DispatchTensor) -> BridgeTensor
Builds a bridge tensor that wraps a floating-point dispatch tensor.
Available with the extension feature for backend-extension authors.
pub fn int(tensor: DispatchTensor) -> BridgeTensor
pub fn int(tensor: DispatchTensor) -> BridgeTensor
Builds a bridge tensor that wraps an integer dispatch tensor.
Available with the extension feature for backend-extension authors.
pub fn bool(tensor: DispatchTensor) -> BridgeTensor
pub fn bool(tensor: DispatchTensor) -> BridgeTensor
Builds a bridge tensor that wraps a boolean dispatch tensor.
Available with the extension feature for backend-extension authors.
pub fn qfloat(tensor: DispatchTensor) -> BridgeTensor
pub fn qfloat(tensor: DispatchTensor) -> BridgeTensor
Builds a bridge tensor that wraps a quantized floating-point dispatch tensor.
Available with the extension feature for backend-extension authors.
pub fn kind(&self) -> BridgeKind
pub fn kind(&self) -> BridgeKind
Returns the runtime tag identifying which variant this tensor wraps.
pub fn into_parts(self) -> (BridgeKind, DispatchTensor)
pub fn into_parts(self) -> (BridgeKind, DispatchTensor)
Consumes the bridge tensor and returns its variant tag together with the underlying dispatch tensor.
Available with the extension feature for backend-extension authors.
pub fn as_parts(&self) -> (BridgeKind, &DispatchTensor)
pub fn as_parts(&self) -> (BridgeKind, &DispatchTensor)
Borrows the bridge tensor as its variant tag together with a reference to the underlying dispatch tensor.
Available with the extension feature for backend-extension authors.
pub fn can_mut(&self) -> bool
pub fn can_mut(&self) -> bool
Whether the tensor’s buffer can be mutated in place (see
TensorMetadata::can_mut).
Trait Implementations§
§impl Clone for BridgeTensor
impl Clone for BridgeTensor
§fn clone(&self) -> BridgeTensor
fn clone(&self) -> BridgeTensor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for BridgeTensor
impl Debug for BridgeTensor
§impl From<BridgeTensor> for DispatchTensor
impl From<BridgeTensor> for DispatchTensor
§fn from(value: BridgeTensor) -> DispatchTensor
fn from(value: BridgeTensor) -> DispatchTensor
Auto Trait Implementations§
impl Freeze for BridgeTensor
impl RefUnwindSafe for BridgeTensor
impl Send for BridgeTensor
impl Sync for BridgeTensor
impl Unpin for BridgeTensor
impl UnsafeUnpin for BridgeTensor
impl UnwindSafe for BridgeTensor
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