pub struct TensorExpansion<T, S, const D: usize, const I: usize> { /* private fields */ }
Expand description

A combination of dimension names and a tensor. The provided dimensions increase the dimensionality of the TensorRef exposed to more than the dimensionality of the TensorRef this is created from, by adding additional dimensions with a length of one.

use easy_ml::tensors::Tensor;
use easy_ml::tensors::views::{TensorView, TensorExpansion};
let vector = Tensor::from([("a", 2)], vec![ 16, 8 ]);
let matrix = vector.expand([(1, "b")]);
let also_matrix = TensorView::from(TensorExpansion::from(&vector, [(1, "b")]));
assert_eq!(matrix, also_matrix);
assert_eq!(matrix, Tensor::from([("a", 2), ("b", 1)], vec![ 16, 8 ]));

Note: due to limitations in Rust’s const generics support, TensorExpansion only implements TensorRef for D from 1 to 6.

Implementations§

source§

impl<T, S, const D: usize, const I: usize> TensorExpansion<T, S, D, I>where
    S: TensorRef<T, D>,

source

pub fn from(
    source: S,
    extra_dimension_names: [(usize, Dimension); I]
) -> TensorExpansion<T, S, D, I>

Creates a TensorExpansion from a source and extra dimension names inserted into the shape at the provided indexes.

Each extra dimension name adds a dimension to the tensor with a length of 1 so they do not change the total number of elements. Hence, a vector can be viewed as a matrix if you provide an extra row/column dimension. More generally, the tensor the TensorExpansion exposes will have a dimensionality of D + I, where D is the dimensionality of the source, and I is the dimensionality of the extra dimensions.

The extra dimension names can be added before any dimensions in the source’s shape, in the range 0 inclusive to D inclusive. It is possible to add multiple dimension names before an existing dimension.

Panics
  • If any extra dimension name is already in use
  • If any dimension number d to insert an extra dimension name into is not 0 <= d <= D
  • If the extra dimension names are not unique
source

pub fn source(self) -> S

source

pub fn source_ref(&self) -> &S

Trait Implementations§

source§

impl<T: Clone, S: Clone, const D: usize, const I: usize> Clone for TensorExpansion<T, S, D, I>

source§

fn clone(&self) -> TensorExpansion<T, S, D, I>

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<T: Debug, S: Debug, const D: usize, const I: usize> Debug for TensorExpansion<T, S, D, I>

source§

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

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

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 0, 1>where
    S: TensorMut<T, 0>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 1]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 1]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 0, 2>where
    S: TensorMut<T, 0>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 2]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 2]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 0, 3>where
    S: TensorMut<T, 0>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 3]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 3]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 0, 4>where
    S: TensorMut<T, 0>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 4]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 4]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 0, 5>where
    S: TensorMut<T, 0>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 5]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 5]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 0, 6>where
    S: TensorMut<T, 0>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 6]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 6]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 1, 1>where
    S: TensorMut<T, 1>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 2]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 2]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 1, 2>where
    S: TensorMut<T, 1>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 3]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 3]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 1, 3>where
    S: TensorMut<T, 1>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 4]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 4]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 1, 4>where
    S: TensorMut<T, 1>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 5]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 5]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 1, 5>where
    S: TensorMut<T, 1>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 6]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 6]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 2, 1>where
    S: TensorMut<T, 2>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 3]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 3]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 2, 2>where
    S: TensorMut<T, 2>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 4]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 4]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 2, 3>where
    S: TensorMut<T, 2>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 5]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 5]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 2, 4>where
    S: TensorMut<T, 2>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 6]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 6]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 3, 1>where
    S: TensorMut<T, 3>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 4]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 4]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 3, 2>where
    S: TensorMut<T, 3>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 5]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 5]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 3, 3>where
    S: TensorMut<T, 3>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 6]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 6]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 4, 1>where
    S: TensorMut<T, 4>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 5]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 5]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 4, 2>where
    S: TensorMut<T, 4>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 6]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 6]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 5, 1>where
    S: TensorMut<T, 5>,

source§

fn get_reference_mut(&mut self, indexes: [usize; 6]) -> Option<&mut T>

Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
source§

unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; 6]) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 0, 1>where
    S: TensorRef<T, 0>,

source§

fn get_reference(&self, indexes: [usize; 1]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 1]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 1]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 0, 2>where
    S: TensorRef<T, 0>,

source§

fn get_reference(&self, indexes: [usize; 2]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 2]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 2]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 0, 3>where
    S: TensorRef<T, 0>,

source§

fn get_reference(&self, indexes: [usize; 3]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 3]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 3]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 0, 4>where
    S: TensorRef<T, 0>,

source§

fn get_reference(&self, indexes: [usize; 4]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 4]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 4]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 0, 5>where
    S: TensorRef<T, 0>,

source§

fn get_reference(&self, indexes: [usize; 5]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 5]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 5]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 0, 6>where
    S: TensorRef<T, 0>,

source§

fn get_reference(&self, indexes: [usize; 6]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 6]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 6]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 1, 1>where
    S: TensorRef<T, 1>,

source§

fn get_reference(&self, indexes: [usize; 2]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 2]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 2]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 1, 2>where
    S: TensorRef<T, 1>,

source§

fn get_reference(&self, indexes: [usize; 3]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 3]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 3]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 1, 3>where
    S: TensorRef<T, 1>,

source§

fn get_reference(&self, indexes: [usize; 4]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 4]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 4]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 1, 4>where
    S: TensorRef<T, 1>,

source§

fn get_reference(&self, indexes: [usize; 5]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 5]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 5]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 1, 5>where
    S: TensorRef<T, 1>,

source§

fn get_reference(&self, indexes: [usize; 6]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 6]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 6]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 2, 1>where
    S: TensorRef<T, 2>,

source§

fn get_reference(&self, indexes: [usize; 3]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 3]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 3]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 2, 2>where
    S: TensorRef<T, 2>,

source§

fn get_reference(&self, indexes: [usize; 4]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 4]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 4]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 2, 3>where
    S: TensorRef<T, 2>,

source§

fn get_reference(&self, indexes: [usize; 5]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 5]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 5]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 2, 4>where
    S: TensorRef<T, 2>,

source§

fn get_reference(&self, indexes: [usize; 6]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 6]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 6]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 3, 1>where
    S: TensorRef<T, 3>,

source§

fn get_reference(&self, indexes: [usize; 4]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 4]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 4]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 3, 2>where
    S: TensorRef<T, 3>,

source§

fn get_reference(&self, indexes: [usize; 5]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 5]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 5]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 3, 3>where
    S: TensorRef<T, 3>,

source§

fn get_reference(&self, indexes: [usize; 6]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 6]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 6]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 4, 1>where
    S: TensorRef<T, 4>,

source§

fn get_reference(&self, indexes: [usize; 5]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 5]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 5]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 4, 2>where
    S: TensorRef<T, 4>,

source§

fn get_reference(&self, indexes: [usize; 6]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 6]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 6]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more
source§

impl<T, S> TensorRef<T, { $d + $i }> for TensorExpansion<T, S, 5, 1>where
    S: TensorRef<T, 5>,

source§

fn get_reference(&self, indexes: [usize; 6]) -> Option<&T>

Gets a reference to the value at the index if the index is in range. Otherwise returns None.
source§

fn view_shape(&self) -> [(Dimension, usize); 6]

The shape this tensor has. See dimensions for an overview. The product of the lengths in the pairs define how many elements are in the tensor (or the portion of it that is visible).
source§

unsafe fn get_reference_unchecked(&self, indexes: [usize; 6]) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference. Read more
source§

fn data_layout(&self) -> DataLayout<{ _ }>

The way the data in this tensor is laid out in memory. In particular, Linear has several requirements on what is returned that must be upheld by implementations of this trait. Read more

Auto Trait Implementations§

§

impl<T, S, const D: usize, const I: usize> RefUnwindSafe for TensorExpansion<T, S, D, I>where
    S: RefUnwindSafe,
    T: RefUnwindSafe,

§

impl<T, S, const D: usize, const I: usize> Send for TensorExpansion<T, S, D, I>where
    S: Send,
    T: Send,

§

impl<T, S, const D: usize, const I: usize> Sync for TensorExpansion<T, S, D, I>where
    S: Sync,
    T: Sync,

§

impl<T, S, const D: usize, const I: usize> Unpin for TensorExpansion<T, S, D, I>where
    S: Unpin,
    T: Unpin,

§

impl<T, S, const D: usize, const I: usize> UnwindSafe for TensorExpansion<T, S, D, I>where
    S: UnwindSafe,
    T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.

source§

impl<T> ToOwned for Twhere
    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 Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.