pub enum MetadataTensorMut<'a> {
I32(&'a mut Tensor<i32>),
Bool(&'a mut Tensor<u8>),
}Expand description
Erased mutable metadata tensor reference.
§Examples
ⓘ
use tenferro_device::LogicalMemorySpace;
use tenferro_prims::{MetadataDType, MetadataTensorMut};
use tenferro_tensor::{MemoryOrder, Tensor};
let mut tensor = Tensor::<u8>::zeros(
&[2, 2],
LogicalMemorySpace::MainMemory,
MemoryOrder::ColumnMajor,
);
let metadata = MetadataTensorMut::Bool(&mut tensor);
assert_eq!(metadata.dtype(), MetadataDType::Bool);Variants§
I32(&'a mut Tensor<i32>)
A metadata tensor stored as i32.
Bool(&'a mut Tensor<u8>)
A logical bool/mask metadata tensor backed by u8 for now.
Implementations§
Source§impl<'a> MetadataTensorMut<'a>
impl<'a> MetadataTensorMut<'a>
Sourcepub const fn dtype(&self) -> MetadataDType
pub const fn dtype(&self) -> MetadataDType
Return the logical dtype carried by this metadata tensor handle.
§Examples
ⓘ
use tenferro_device::LogicalMemorySpace;
use tenferro_prims::{MetadataDType, MetadataTensorMut};
use tenferro_tensor::{MemoryOrder, Tensor};
let mut tensor = Tensor::<i32>::zeros(
&[1],
LogicalMemorySpace::MainMemory,
MemoryOrder::ColumnMajor,
);
let metadata = MetadataTensorMut::I32(&mut tensor);
assert_eq!(metadata.dtype(), MetadataDType::I32);Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for MetadataTensorMut<'a>
impl<'a> !RefUnwindSafe for MetadataTensorMut<'a>
impl<'a> Send for MetadataTensorMut<'a>
impl<'a> Sync for MetadataTensorMut<'a>
impl<'a> Unpin for MetadataTensorMut<'a>
impl<'a> !UnwindSafe for MetadataTensorMut<'a>
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<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
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