pub enum TensorMutable<'a, T, B, D>where
B: DeviceRawAPI<T>,
D: DimAPI,{
Owned(Tensor<T, B, D>),
Mut(TensorMut<'a, T, B, D>),
ToBeCloned(TensorMut<'a, T, B, D>, Tensor<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(Tensor<T, B, D>)
Mut(TensorMut<'a, T, B, D>)
ToBeCloned(TensorMut<'a, T, B, D>, Tensor<T, B, D>)
Implementations§
Source§impl<T, B, D> TensorMutable<'_, T, B, D>
impl<T, B, D> TensorMutable<'_, T, B, D>
Source§impl<T, B, D> TensorMutable<'_, T, B, D>where
T: Clone,
D: DimAPI,
B: DeviceAPI<T> + DeviceCreationAnyAPI<T> + OpAssignAPI<T, D>,
B::Raw: Clone,
impl<T, B, D> TensorMutable<'_, T, B, D>where
T: Clone,
D: DimAPI,
B: DeviceAPI<T> + DeviceCreationAnyAPI<T> + OpAssignAPI<T, D>,
B::Raw: Clone,
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>>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> + DeviceCreationAnyAPI<T> + OpAssignAPI<T, D>,
B::Raw: Clone,
impl<T, B, D> TensorIntoOwnedAPI<T, B, D> for TensorMutable<'_, T, B, D>where
T: Clone,
D: DimAPI,
B: DeviceAPI<T> + DeviceCreationAnyAPI<T> + OpAssignAPI<T, D>,
B::Raw: Clone,
Source§fn into_owned(self) -> Tensor<T, B, D>
fn into_owned(self) -> Tensor<T, B, D>
Convert tensor into owned tensor. Read more
Source§impl<T, B, D> TensorViewAPI<T, B, D> for TensorMutable<'_, T, B, D>
impl<T, B, D> TensorViewAPI<T, B, D> for TensorMutable<'_, T, B, D>
Source§fn view(&self) -> TensorView<'_, T, B, D>
fn view(&self) -> TensorView<'_, T, B, D>
Get a view of tensor.
Source§impl<T, B, D> TensorViewMutAPI<T, B, D> for TensorMutable<'_, T, B, D>
impl<T, B, D> TensorViewMutAPI<T, B, D> for TensorMutable<'_, T, B, D>
Source§fn view_mut(&mut self) -> TensorViewMut<'_, T, B, D>
fn view_mut(&mut self) -> TensorViewMut<'_, T, B, D>
Get a mutable view of tensor.
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> 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