[−][src]Struct tension::Shape
Structure representing shape of the tensor.
Tensor supposed to have an infinite number of axes. E.g. tensor of shape (x,y,z)
supposed to be (x,y,z,1,1,1,...)
.
That means that trailing axes of size 1
are ignored, so shapes (x,y,z)
and (x,y,z,1)
are equal.
There may be a tensor of shape (,)
(0-dimensional tensor or scalar).
Implementations
impl Shape
[src]
pub fn len(&self) -> usize
[src]
Count of dimensions without trailing 1
s in the end.
pub fn as_slice(&self) -> &[usize]
[src]
Slice of dimension sizes.
pub fn as_mut_slice(&mut self) -> &mut [usize]
[src]
Mutable slice of dimension sizes.
pub fn iter(&self) -> Iter<'_, usize>
[src]
Iterator over dimension sizes.
pub fn iter_mut(&mut self) -> IterMut<'_, usize>
[src]
Mutable iterator over dimension sizes.
pub fn content(&self) -> usize
[src]
Number of items in tensor of this shape.
impl Shape
[src]
pub fn slice<R: RangeBounds<usize>>(&self, range: R) -> Shape
[src]
Slicing operation.
Returns a new shape sliced from the original one.
Sadly, you cannot use shape[a..b]
syntax because Rust Index
trait is required to return a reference.
Trait Implementations
impl Clone for Shape
[src]
impl Debug for Shape
[src]
impl<'_> From<&'_ [usize]> for Shape
[src]
impl From<Vec<usize>> for Shape
[src]
impl Index<usize> for Shape
[src]
impl IndexMut<usize> for Shape
[src]
impl Into<Vec<usize>> for Shape
[src]
impl PartialEq<Shape> for Shape
[src]
Auto Trait Implementations
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnwindSafe for Shape
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,