pub struct StridedMut<'a, T> { /* private fields */ }
Expand description
A mutable strided iterator over tensor elements.
This struct provides mutable access to tensor elements with strided access patterns in single thread
.
Implementations§
Source§impl<'a, T: CommonBounds> StridedMut<'a, T>
impl<'a, T: CommonBounds> StridedMut<'a, T>
Sourcepub fn new<U: TensorInfo<T>>(tensor: U) -> Self
pub fn new<U: TensorInfo<T>>(tensor: U) -> Self
Sourcepub fn zip<C>(self, other: C) -> StridedZip<'a, Self, C>
pub fn zip<C>(self, other: C) -> StridedZip<'a, Self, C>
Combines this StridedMut
iterator with another iterator, enabling simultaneous iteration.
This method performs shape broadcasting between self
and other
to ensure that both iterators
iterate over tensors with compatible shapes. It adjusts the strides and shapes of both iterators
to match the broadcasted shape and then returns a StridedZip
that allows for synchronized
iteration over both iterators.
§Arguments
other
- The other iterator to zip with. It must implement theIterGetSet
trait, and its associatedItem
type must beSend
.
§Returns
A StridedZip
instance that zips together self
and other
, enabling synchronized
iteration over their elements.
§Panics
This method will panic if the shapes of self
and other
cannot be broadcasted together.
Ensure that the shapes are compatible before calling this method.
Trait Implementations§
Source§impl<'a, T> IterGetSet for StridedMut<'a, T>where
T: CommonBounds + 'a,
impl<'a, T> IterGetSet for StridedMut<'a, T>where
T: CommonBounds + 'a,
Source§fn set_end_index(&mut self, end_index: usize)
fn set_end_index(&mut self, end_index: usize)
Source§fn set_intervals(&mut self, intervals: Arc<Vec<(usize, usize)>>)
fn set_intervals(&mut self, intervals: Arc<Vec<(usize, usize)>>)
Source§fn set_strides(&mut self, strides: Strides)
fn set_strides(&mut self, strides: Strides)
Source§fn set_shape(&mut self, shape: Shape)
fn set_shape(&mut self, shape: Shape)
Source§fn broadcast_set_strides(&mut self, shape: &Shape)
fn broadcast_set_strides(&mut self, shape: &Shape)
Source§fn outer_loop_size(&self) -> usize
fn outer_loop_size(&self) -> usize
Source§fn inner_loop_size(&self) -> usize
fn inner_loop_size(&self) -> usize
Source§fn inner_loop_next(&mut self, index: usize) -> Self::Item
fn inner_loop_next(&mut self, index: usize) -> Self::Item
Source§impl<'a, T: CommonBounds> StridedIterator for StridedMut<'a, T>
impl<'a, T: CommonBounds> StridedIterator for StridedMut<'a, T>
impl<'a, T: CommonBounds> StridedIteratorZip for StridedMut<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for StridedMut<'a, T>
impl<'a, T> RefUnwindSafe for StridedMut<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for StridedMut<'a, T>
impl<'a, T> Sync for StridedMut<'a, T>
impl<'a, T> Unpin for StridedMut<'a, T>
impl<'a, T> UnwindSafe for StridedMut<'a, T>where
T: RefUnwindSafe,
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
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