pub struct View { /* private fields */ }
Expand description
View holds shape of the tensor and allows for arbitrary number of movement ops (reshape, expand, pad, permute) to be executed as noops (without accessing the actual data).
Implementations§
source§impl View
impl View
sourcepub fn is_contiguous(&self) -> bool
pub fn is_contiguous(&self) -> bool
Is this view contiguous? i. e. no padding, expands or permutes, only reshapes are allowed
sourcepub fn iterate_contiguous<'a, T: Scalar>(
&'a self,
data: &'a [T]
) -> impl Iterator<Item = T> + 'a
pub fn iterate_contiguous<'a, T: Scalar>( &'a self, data: &'a [T] ) -> impl Iterator<Item = T> + 'a
Simple iteration
sourcepub fn iterate_strided<'a, T: Scalar>(
&'a self,
data: &'a [T]
) -> impl Iterator<Item = T> + 'a
pub fn iterate_strided<'a, T: Scalar>( &'a self, data: &'a [T] ) -> impl Iterator<Item = T> + 'a
Iteration with expands and permutes
sourcepub fn iterate_reshaped<'a, T: Scalar>(
&'a self,
data: &'a [T]
) -> impl Iterator<Item = T> + 'a
pub fn iterate_reshaped<'a, T: Scalar>( &'a self, data: &'a [T] ) -> impl Iterator<Item = T> + 'a
Iteration with expands, permutes and reshapes, but without padding
sourcepub fn iterate_padded<'a, T: Scalar>(
&'a self,
data: &'a [T]
) -> impl Iterator<Item = T> + 'a
pub fn iterate_padded<'a, T: Scalar>( &'a self, data: &'a [T] ) -> impl Iterator<Item = T> + 'a
Iteration with expands, permutes, reshapes and padding
sourcepub fn cidx(&self) -> Index
pub fn cidx(&self) -> Index
Access data called name with idx0-idx{rank} converted into self view. This is used by compiled backends. Returns padding condition and index. If padding condition == 0, padding value is applied, if padding condition is one, value is drawn from data.
sourcepub fn original_shape(&self) -> &Shape
pub fn original_shape(&self) -> &Shape
Original (first) shape of self.
sourcepub fn original_numel(&self) -> usize
pub fn original_numel(&self) -> usize
Original number of elements of self.
Trait Implementations§
source§impl Ord for View
impl Ord for View
source§impl PartialEq for View
impl PartialEq for View
source§impl PartialOrd for View
impl PartialOrd for View
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for View
impl StructuralPartialEq for View
Auto Trait Implementations§
impl Freeze for View
impl RefUnwindSafe for View
impl Send for View
impl Sync for View
impl Unpin for View
impl UnwindSafe for View
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