pub enum TensorMutable<'a, T, B, D>where
B: DeviceRawAPI<T>,
D: DimAPI,{
Owned(TensorBase<Storage<DataOwned<<B as DeviceRawAPI<T>>::Raw>, T, B>, D>),
Mut(TensorBase<Storage<DataMut<'a, <B as DeviceRawAPI<T>>::Raw>, T, B>, D>),
ToBeCloned(TensorBase<Storage<DataMut<'a, <B as DeviceRawAPI<T>>::Raw>, T, B>, D>, TensorBase<Storage<DataOwned<<B as DeviceRawAPI<T>>::Raw>, T, B>, D>),
}Expand description
Mutable tensor (either owned or mutable reference).
This is mostly used for inplace operations as output.
It is designed similar to TensorCow.
However, if inplace operation is not convenient because of the layout
contiguous not fulfilled, a ToBeCloned variant is provided, where an owned
tensor with contiguous layout is generated. This is not the same to
TensorCow, where it only involves ownership conversion, but not layout
difference between two tensors. So this is defined as a special type.
Variants§
Owned(TensorBase<Storage<DataOwned<<B as DeviceRawAPI<T>>::Raw>, T, B>, D>)
Mut(TensorBase<Storage<DataMut<'a, <B as DeviceRawAPI<T>>::Raw>, T, B>, D>)
ToBeCloned(TensorBase<Storage<DataMut<'a, <B as DeviceRawAPI<T>>::Raw>, T, B>, D>, TensorBase<Storage<DataOwned<<B as DeviceRawAPI<T>>::Raw>, T, B>, D>)
Implementations§
Source§impl<T, B, D> TensorMutable<'_, T, B, D>
impl<T, B, D> TensorMutable<'_, T, B, D>
pub fn clone_to_mut(self) -> TensorMutable<'_, T, B, D>
pub fn into_reverse_axes(self) -> TensorMutable<'_, T, B, D>
pub fn f_prefer(&self) -> bool
pub fn c_prefer(&self) -> bool
pub fn f_contig(&self) -> bool
pub fn c_contig(&self) -> bool
Source§impl<T, B, D> TensorMutable<'_, T, B, D>where
T: Clone,
D: DimAPI,
B: DeviceAPI<T> + DeviceRawAPI<MaybeUninit<T>> + DeviceCreationAnyAPI<T> + OpAssignAPI<T, D>,
<B as DeviceRawAPI<T>>::Raw: Clone,
impl<T, B, D> TensorMutable<'_, T, B, D>where
T: Clone,
D: DimAPI,
B: DeviceAPI<T> + DeviceRawAPI<MaybeUninit<T>> + DeviceCreationAnyAPI<T> + OpAssignAPI<T, D>,
<B as DeviceRawAPI<T>>::Raw: Clone,
pub fn to_owned( &self, ) -> TensorBase<Storage<DataOwned<<B as DeviceRawAPI<T>>::Raw>, T, B>, D>
Source§impl<'a, T, B, D> TensorMutable<'a, T, B, D>
impl<'a, T, B, D> TensorMutable<'a, T, B, D>
pub fn into_dim_f<D2>(self) -> Result<TensorMutable<'a, T, B, D2>, Error>where
D: DimIntoAPI<D2>,
D2: DimAPI,
pub fn into_dim<D2>(self) -> TensorMutable<'a, T, B, D2>where
D: DimIntoAPI<D2>,
D2: DimAPI,
Trait Implementations§
Source§impl<T, B, D> TensorIntoOwnedAPI<T, B, D> for TensorMutable<'_, T, B, D>where
T: Clone,
D: DimAPI,
B: DeviceAPI<T> + DeviceRawAPI<MaybeUninit<T>> + DeviceCreationAnyAPI<T> + OpAssignAPI<T, D>,
<B as DeviceRawAPI<T>>::Raw: Clone,
impl<T, B, D> TensorIntoOwnedAPI<T, B, D> for TensorMutable<'_, T, B, D>where
T: Clone,
D: DimAPI,
B: DeviceAPI<T> + DeviceRawAPI<MaybeUninit<T>> + DeviceCreationAnyAPI<T> + OpAssignAPI<T, D>,
<B as DeviceRawAPI<T>>::Raw: Clone,
Source§fn into_owned(
self,
) -> TensorBase<Storage<DataOwned<<B as DeviceRawAPI<T>>::Raw>, T, B>, D>
fn into_owned( self, ) -> TensorBase<Storage<DataOwned<<B as DeviceRawAPI<T>>::Raw>, T, B>, D>
Convert tensor into owned tensor. Read more
Source§impl<T, B, D> TensorViewAPI for TensorMutable<'_, T, B, D>
impl<T, B, D> TensorViewAPI for TensorMutable<'_, T, B, D>
Auto Trait Implementations§
impl<'a, T, B, D> Freeze for TensorMutable<'a, T, B, D>
impl<'a, T, B, D> RefUnwindSafe for TensorMutable<'a, T, B, D>where
B: RefUnwindSafe,
D: RefUnwindSafe,
<D as DimBaseAPI>::Stride: RefUnwindSafe,
<B as DeviceRawAPI<T>>::Raw: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, B, D> Send for TensorMutable<'a, T, B, D>
impl<'a, T, B, D> Sync for TensorMutable<'a, T, B, D>
impl<'a, T, B, D> Unpin for TensorMutable<'a, T, B, D>where
B: Unpin,
D: Unpin,
<D as DimBaseAPI>::Stride: Unpin,
<B as DeviceRawAPI<T>>::Raw: Unpin,
T: Unpin,
impl<'a, T, B, D> !UnwindSafe for TensorMutable<'a, T, B, D>
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
Source§impl<T> DTypePromoteAPI<T> for T
impl<T> DTypePromoteAPI<T> for T
const SAME_TYPE: bool = true
const CAN_CAST_SELF: bool = true
const CAN_CAST_OTHER: bool = true
type Res = T
fn promote_self(self) -> <T as DTypePromoteAPI<T>>::Res
fn promote_other(val: T) -> <T as DTypePromoteAPI<T>>::Res
fn promote_pair(self, val: T) -> (Self::Res, Self::Res)where
Self: Sized,
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