pub struct SliceSpec {
pub start: Vec<usize>,
pub end: Vec<usize>,
}Expand description
Describes a per-dimension [start, end) range that selects a contiguous
sub-region of a tensor.
Both start and end must have the same length as the enclosing tensor’s
rank, and for each dimension start[i] <= end[i].
Fields§
§start: Vec<usize>Per-dimension start index (inclusive).
end: Vec<usize>Per-dimension end index (exclusive).
Implementations§
Source§impl SliceSpec
impl SliceSpec
Sourcepub fn element_count(&self) -> usize
pub fn element_count(&self) -> usize
Number of elements covered by this slice.
Computed as ∏ (end[i] − start[i]). Zero-length dimensions contribute
a factor of 0, resulting in an empty slice.
Sourcepub fn overlaps(&self, other: &SliceSpec) -> bool
pub fn overlaps(&self, other: &SliceSpec) -> bool
Returns true when self and other share at least one element.
Two slices overlap iff for every dimension d:
self.start[d] < other.end[d] && other.start[d] < self.end[d].
If the two specs have different ranks the function returns false rather
than panicking.
Trait Implementations§
impl Eq for SliceSpec
impl StructuralPartialEq for SliceSpec
Auto Trait Implementations§
impl Freeze for SliceSpec
impl RefUnwindSafe for SliceSpec
impl Send for SliceSpec
impl Sync for SliceSpec
impl Unpin for SliceSpec
impl UnsafeUnpin for SliceSpec
impl UnwindSafe for SliceSpec
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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