[][src]Struct tension::Shape

pub struct Shape { /* fields omitted */ }

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 1s 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]

type Output = usize

The returned type after indexing.

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.