pub struct TensorShape {
    pub dims_strides: Vec<(Unitless, Unitless)>,
}
Expand description

The shape of an N-dimensional tensor has a size for each dimension, with an associated stride, e.g., a row-major 3 x 5 matrix will have a stride of 5 for the dimension of size 3 and a stride of 1 for the dimension of size 5, and the resulting dims_strides is [(3, 5), (5, 1)]. Index 0 of dims_strides always refers to the leftmost dimension.

Fields§

§dims_strides: Vec<(Unitless, Unitless)>

Implementations§

source§

impl TensorShape

source

pub fn dims(&self) -> Vec<Unitless>

source

pub fn strides(&self) -> Vec<Unitless>

source

pub fn ndim(&self) -> usize

source

pub fn num_elements(&self) -> usize

source

pub fn to_transposed(&self, axes: Vec<AxisIndex>) -> TensorShape

Trait Implementations§

source§

impl Clone for TensorShape

source§

fn clone(&self) -> TensorShape

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TensorShape

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&[isize; 1]> for TensorShape

source§

fn from(shape: &[isize; 1]) -> Self

Converts to this type from the input type.
source§

impl From<&[isize; 2]> for TensorShape

source§

fn from(shape: &[isize; 2]) -> Self

Converts to this type from the input type.
source§

impl From<&[isize; 3]> for TensorShape

source§

fn from(shape: &[isize; 3]) -> Self

Converts to this type from the input type.
source§

impl From<&[isize; 4]> for TensorShape

source§

fn from(shape: &[isize; 4]) -> Self

Converts to this type from the input type.
source§

impl From<&[isize; 5]> for TensorShape

source§

fn from(shape: &[isize; 5]) -> Self

Converts to this type from the input type.
source§

impl From<&[isize; 6]> for TensorShape

source§

fn from(shape: &[isize; 6]) -> Self

Converts to this type from the input type.
source§

impl From<&[isize; 7]> for TensorShape

source§

fn from(shape: &[isize; 7]) -> Self

Converts to this type from the input type.
source§

impl From<&[isize; 8]> for TensorShape

source§

fn from(shape: &[isize; 8]) -> Self

Converts to this type from the input type.
source§

impl From<&[usize; 1]> for TensorShape

source§

fn from(shape: &[usize; 1]) -> Self

Converts to this type from the input type.
source§

impl From<&[usize; 2]> for TensorShape

source§

fn from(shape: &[usize; 2]) -> Self

Converts to this type from the input type.
source§

impl From<&[usize; 3]> for TensorShape

source§

fn from(shape: &[usize; 3]) -> Self

Converts to this type from the input type.
source§

impl From<&[usize; 4]> for TensorShape

source§

fn from(shape: &[usize; 4]) -> Self

Converts to this type from the input type.
source§

impl From<&[usize; 5]> for TensorShape

source§

fn from(shape: &[usize; 5]) -> Self

Converts to this type from the input type.
source§

impl From<&[usize; 6]> for TensorShape

source§

fn from(shape: &[usize; 6]) -> Self

Converts to this type from the input type.
source§

impl From<&[usize; 7]> for TensorShape

source§

fn from(shape: &[usize; 7]) -> Self

Converts to this type from the input type.
source§

impl From<&[usize; 8]> for TensorShape

source§

fn from(shape: &[usize; 8]) -> Self

Converts to this type from the input type.
source§

impl From<&Vec<i32>> for TensorShape

source§

fn from(shape: &Vec<i32>) -> Self

Converts to this type from the input type.
source§

impl From<&Vec<i64>> for TensorShape

source§

fn from(shape: &Vec<i64>) -> Self

Converts to this type from the input type.
source§

impl From<&Vec<isize>> for TensorShape

source§

fn from(shape: &Vec<isize>) -> Self

Converts to this type from the input type.
source§

impl From<&Vec<u32>> for TensorShape

source§

fn from(shape: &Vec<u32>) -> Self

Converts to this type from the input type.
source§

impl From<&Vec<u64>> for TensorShape

source§

fn from(shape: &Vec<u64>) -> Self

Converts to this type from the input type.
source§

impl From<&Vec<usize>> for TensorShape

source§

fn from(shape: &Vec<usize>) -> Self

Converts to this type from the input type.
source§

impl From<[i32; 1]> for TensorShape

source§

fn from(shape: [i32; 1]) -> Self

Converts to this type from the input type.
source§

impl From<[i32; 2]> for TensorShape

source§

fn from(shape: [i32; 2]) -> Self

Converts to this type from the input type.
source§

impl From<[i32; 3]> for TensorShape

source§

fn from(shape: [i32; 3]) -> Self

Converts to this type from the input type.
source§

impl From<[i32; 4]> for TensorShape

source§

fn from(shape: [i32; 4]) -> Self

Converts to this type from the input type.
source§

impl From<[i32; 5]> for TensorShape

source§

fn from(shape: [i32; 5]) -> Self

Converts to this type from the input type.
source§

impl From<[i32; 6]> for TensorShape

source§

fn from(shape: [i32; 6]) -> Self

Converts to this type from the input type.
source§

impl From<[i32; 7]> for TensorShape

source§

fn from(shape: [i32; 7]) -> Self

Converts to this type from the input type.
source§

impl From<[i32; 8]> for TensorShape

source§

fn from(shape: [i32; 8]) -> Self

Converts to this type from the input type.
source§

impl From<[i64; 1]> for TensorShape

source§

fn from(shape: [i64; 1]) -> Self

Converts to this type from the input type.
source§

impl From<[i64; 2]> for TensorShape

source§

fn from(shape: [i64; 2]) -> Self

Converts to this type from the input type.
source§

impl From<[i64; 3]> for TensorShape

source§

fn from(shape: [i64; 3]) -> Self

Converts to this type from the input type.
source§

impl From<[i64; 4]> for TensorShape

source§

fn from(shape: [i64; 4]) -> Self

Converts to this type from the input type.
source§

impl From<[i64; 5]> for TensorShape

source§

fn from(shape: [i64; 5]) -> Self

Converts to this type from the input type.
source§

impl From<[i64; 6]> for TensorShape

source§

fn from(shape: [i64; 6]) -> Self

Converts to this type from the input type.
source§

impl From<[i64; 7]> for TensorShape

source§

fn from(shape: [i64; 7]) -> Self

Converts to this type from the input type.
source§

impl From<[i64; 8]> for TensorShape

source§

fn from(shape: [i64; 8]) -> Self

Converts to this type from the input type.
source§

impl From<[isize; 1]> for TensorShape

source§

fn from(shape: [isize; 1]) -> Self

Converts to this type from the input type.
source§

impl From<[isize; 2]> for TensorShape

source§

fn from(shape: [isize; 2]) -> Self

Converts to this type from the input type.
source§

impl From<[isize; 3]> for TensorShape

source§

fn from(shape: [isize; 3]) -> Self

Converts to this type from the input type.
source§

impl From<[isize; 4]> for TensorShape

source§

fn from(shape: [isize; 4]) -> Self

Converts to this type from the input type.
source§

impl From<[isize; 5]> for TensorShape

source§

fn from(shape: [isize; 5]) -> Self

Converts to this type from the input type.
source§

impl From<[isize; 6]> for TensorShape

source§

fn from(shape: [isize; 6]) -> Self

Converts to this type from the input type.
source§

impl From<[isize; 7]> for TensorShape

source§

fn from(shape: [isize; 7]) -> Self

Converts to this type from the input type.
source§

impl From<[isize; 8]> for TensorShape

source§

fn from(shape: [isize; 8]) -> Self

Converts to this type from the input type.
source§

impl From<[u32; 1]> for TensorShape

source§

fn from(shape: [u32; 1]) -> Self

Converts to this type from the input type.
source§

impl From<[u32; 2]> for TensorShape

source§

fn from(shape: [u32; 2]) -> Self

Converts to this type from the input type.
source§

impl From<[u32; 3]> for TensorShape

source§

fn from(shape: [u32; 3]) -> Self

Converts to this type from the input type.
source§

impl From<[u32; 4]> for TensorShape

source§

fn from(shape: [u32; 4]) -> Self

Converts to this type from the input type.
source§

impl From<[u32; 5]> for TensorShape

source§

fn from(shape: [u32; 5]) -> Self

Converts to this type from the input type.
source§

impl From<[u32; 6]> for TensorShape

source§

fn from(shape: [u32; 6]) -> Self

Converts to this type from the input type.
source§

impl From<[u32; 7]> for TensorShape

source§

fn from(shape: [u32; 7]) -> Self

Converts to this type from the input type.
source§

impl From<[u32; 8]> for TensorShape

source§

fn from(shape: [u32; 8]) -> Self

Converts to this type from the input type.
source§

impl From<[u64; 1]> for TensorShape

source§

fn from(shape: [u64; 1]) -> Self

Converts to this type from the input type.
source§

impl From<[u64; 2]> for TensorShape

source§

fn from(shape: [u64; 2]) -> Self

Converts to this type from the input type.
source§

impl From<[u64; 3]> for TensorShape

source§

fn from(shape: [u64; 3]) -> Self

Converts to this type from the input type.
source§

impl From<[u64; 4]> for TensorShape

source§

fn from(shape: [u64; 4]) -> Self

Converts to this type from the input type.
source§

impl From<[u64; 5]> for TensorShape

source§

fn from(shape: [u64; 5]) -> Self

Converts to this type from the input type.
source§

impl From<[u64; 6]> for TensorShape

source§

fn from(shape: [u64; 6]) -> Self

Converts to this type from the input type.
source§

impl From<[u64; 7]> for TensorShape

source§

fn from(shape: [u64; 7]) -> Self

Converts to this type from the input type.
source§

impl From<[u64; 8]> for TensorShape

source§

fn from(shape: [u64; 8]) -> Self

Converts to this type from the input type.
source§

impl From<[usize; 1]> for TensorShape

source§

fn from(shape: [usize; 1]) -> Self

Converts to this type from the input type.
source§

impl From<[usize; 2]> for TensorShape

source§

fn from(shape: [usize; 2]) -> Self

Converts to this type from the input type.
source§

impl From<[usize; 3]> for TensorShape

source§

fn from(shape: [usize; 3]) -> Self

Converts to this type from the input type.
source§

impl From<[usize; 4]> for TensorShape

source§

fn from(shape: [usize; 4]) -> Self

Converts to this type from the input type.
source§

impl From<[usize; 5]> for TensorShape

source§

fn from(shape: [usize; 5]) -> Self

Converts to this type from the input type.
source§

impl From<[usize; 6]> for TensorShape

source§

fn from(shape: [usize; 6]) -> Self

Converts to this type from the input type.
source§

impl From<[usize; 7]> for TensorShape

source§

fn from(shape: [usize; 7]) -> Self

Converts to this type from the input type.
source§

impl From<[usize; 8]> for TensorShape

source§

fn from(shape: [usize; 8]) -> Self

Converts to this type from the input type.
source§

impl From<Vec<i32>> for TensorShape

source§

fn from(shape: Vec<i32>) -> Self

Converts to this type from the input type.
source§

impl From<Vec<i64>> for TensorShape

source§

fn from(shape: Vec<i64>) -> Self

Converts to this type from the input type.
source§

impl From<Vec<isize>> for TensorShape

source§

fn from(shape: Vec<isize>) -> Self

Converts to this type from the input type.
source§

impl From<Vec<u32>> for TensorShape

source§

fn from(shape: Vec<u32>) -> Self

Converts to this type from the input type.
source§

impl From<Vec<u64>> for TensorShape

source§

fn from(shape: Vec<u64>) -> Self

Converts to this type from the input type.
source§

impl From<Vec<usize>> for TensorShape

source§

fn from(shape: Vec<usize>) -> Self

Converts to this type from the input type.
source§

impl Ord for TensorShape

source§

fn cmp(&self, other: &TensorShape) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for TensorShape

source§

fn eq(&self, other: &TensorShape) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for TensorShape

source§

fn partial_cmp(&self, other: &TensorShape) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Eq for TensorShape

source§

impl StructuralEq for TensorShape

source§

impl StructuralPartialEq for TensorShape

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V