pub struct TensorViewMut<'a, T: TensorElement> { /* private fields */ }Expand description
Implementations§
Source§impl<'a, T: TensorElement> TensorViewMut<'a, T>
impl<'a, T: TensorElement> TensorViewMut<'a, T>
Sourcepub fn new(
data: &'a mut [T],
shape: Shape,
strides: Vec<usize>,
offset: usize,
) -> Self
pub fn new( data: &'a mut [T], shape: Shape, strides: Vec<usize>, offset: usize, ) -> Self
Create a new mutable tensor view from raw parts
§Arguments
data- Mutable reference to underlying buffershape- Shape of the viewstrides- Strides for indexingoffset- Offset into parent buffer
Sourcepub fn data_mut(&mut self) -> &mut [T]
pub fn data_mut(&mut self) -> &mut [T]
Get a mutable reference to the underlying data slice
For in-place SIMD operations, this provides direct buffer access.
Sourcepub fn is_contiguous(&self) -> bool
pub fn is_contiguous(&self) -> bool
Check if the view is contiguous in memory
Sourcepub fn get_mut(&mut self, index: usize) -> Result<&mut T>
pub fn get_mut(&mut self, index: usize) -> Result<&mut T>
Get mutable element at flat index (zero-copy)
Sourcepub fn iter(&self) -> TensorViewIter<'_, T> ⓘ
pub fn iter(&self) -> TensorViewIter<'_, T> ⓘ
Create an iterator over the view’s elements
Sourcepub fn iter_mut(&mut self) -> TensorViewIterMut<'_, T> ⓘ
pub fn iter_mut(&mut self) -> TensorViewIterMut<'_, T> ⓘ
Create a mutable iterator over the view’s elements
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> !Freeze for TensorViewMut<'a, T>
impl<'a, T> RefUnwindSafe for TensorViewMut<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for TensorViewMut<'a, T>
impl<'a, T> Sync for TensorViewMut<'a, T>
impl<'a, T> Unpin for TensorViewMut<'a, T>
impl<'a, T> UnsafeUnpin for TensorViewMut<'a, T>
impl<'a, T> !UnwindSafe for TensorViewMut<'a, T>
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