pub struct SliceRange { /* private fields */ }Expand description
A per-axis range for slice, one entry per axis.
You rarely name SliceRange directly - the s! macro builds the
list from ordinary range syntax. It converts from a..b, a.., ..b, ..,
and bare integers (a single index); negative bounds count from the end.
§Examples
use candela::{s, Dimension, Tensor};
let t = Tensor::from_slice(&[0.0, 1.0, 2.0, 3.0, 4.0, 5.0], &[2, 3]);
// row 0, columns 1..3
let sub = t.slice(s![0..1, 1..3])?.materialize();
assert_eq!(sub.shape(), &[1, 2]);
let vals: Vec<f64> = sub.iter().copied().collect();
assert_eq!(vals, [1.0, 2.0]);Trait Implementations§
Source§impl Clone for SliceRange
impl Clone for SliceRange
Source§fn clone(&self) -> SliceRange
fn clone(&self) -> SliceRange
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SliceRange
Source§impl Debug for SliceRange
impl Debug for SliceRange
impl Eq for SliceRange
Source§impl From<RangeFull> for SliceRange
impl From<RangeFull> for SliceRange
Source§impl From<i32> for SliceRange
impl From<i32> for SliceRange
Source§impl Hash for SliceRange
impl Hash for SliceRange
Source§impl PartialEq for SliceRange
impl PartialEq for SliceRange
Source§fn eq(&self, other: &SliceRange) -> bool
fn eq(&self, other: &SliceRange) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SliceRange
Auto Trait Implementations§
impl Freeze for SliceRange
impl RefUnwindSafe for SliceRange
impl Send for SliceRange
impl Sync for SliceRange
impl Unpin for SliceRange
impl UnsafeUnpin for SliceRange
impl UnwindSafe for SliceRange
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