Struct TensorIndex

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

A combination of pre provided indexes and a tensor. The provided indexes reduce the dimensionality of the TensorRef exposed to less than the dimensionality of the TensorRef this is created from.

use easy_ml::tensors::Tensor;
use easy_ml::tensors::views::{TensorView, TensorIndex};
let vector = Tensor::from([("a", 2)], vec![ 16, 8 ]);
let scalar = vector.select([("a", 0)]);
let also_scalar = TensorView::from(TensorIndex::from(&vector, [("a", 0)]));
assert_eq!(scalar.index_by([]).get([]), also_scalar.index_by([]).get([]));
assert_eq!(scalar.index_by([]).get([]), 16);

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

Implementations§

Source§

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

Source

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

Creates a TensorIndex from a source and a list of provided dimension name/index pairs.

The corresponding dimensions in the source will be masked to always return the provided index. Henece, a matrix can be viewed as a vector if you provide one of the row/column index to use. More generally, the tensor the TensorIndex exposes will have a dimensionality of D - I, where D is the dimensionality of the source, and I is the dimensionality of the provided indexes.

§Panics
  • If any provided index is for a dimension that does not exist in the source’s shape.
  • If any provided index is not within range for the length of the dimension.
  • If multiple indexes are provided for the same dimension.
Source

pub fn source(self) -> S

Consumes the TensorIndex, yielding the source it was created from.

Source

pub fn source_ref(&self) -> &S

Gives a reference to the TensorIndex’s source (in which the data is not reduced in dimensionality).

Trait Implementations§

Source§

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

Source§

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

Returns a duplicate 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 TensorIndex<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 TensorIndex<T, S, 1, 1>
where S: TensorMut<T, 1>,

Source§

fn get_reference_mut(&mut self, indexes: [usize; 0]) -> 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; 0]) -> &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 TensorIndex<T, S, 2, 1>
where S: TensorMut<T, 2>,

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 TensorIndex<T, S, 2, 2>
where S: TensorMut<T, 2>,

Source§

fn get_reference_mut(&mut self, indexes: [usize; 0]) -> 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; 0]) -> &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 TensorIndex<T, S, 3, 1>
where S: TensorMut<T, 3>,

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 TensorIndex<T, S, 3, 2>
where S: TensorMut<T, 3>,

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 TensorIndex<T, S, 3, 3>
where S: TensorMut<T, 3>,

Source§

fn get_reference_mut(&mut self, indexes: [usize; 0]) -> 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; 0]) -> &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 TensorIndex<T, S, 4, 1>
where S: TensorMut<T, 4>,

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 TensorIndex<T, S, 4, 2>
where S: TensorMut<T, 4>,

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 TensorIndex<T, S, 4, 3>
where S: TensorMut<T, 4>,

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 TensorIndex<T, S, 4, 4>
where S: TensorMut<T, 4>,

Source§

fn get_reference_mut(&mut self, indexes: [usize; 0]) -> 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; 0]) -> &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 TensorIndex<T, S, 5, 1>
where S: TensorMut<T, 5>,

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 TensorIndex<T, S, 5, 2>
where S: TensorMut<T, 5>,

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 TensorIndex<T, S, 5, 3>
where S: TensorMut<T, 5>,

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 TensorIndex<T, S, 5, 4>
where S: TensorMut<T, 5>,

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 TensorIndex<T, S, 5, 5>
where S: TensorMut<T, 5>,

Source§

fn get_reference_mut(&mut self, indexes: [usize; 0]) -> 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; 0]) -> &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 TensorIndex<T, S, 6, 1>
where S: TensorMut<T, 6>,

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 TensorIndex<T, S, 6, 2>
where S: TensorMut<T, 6>,

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 TensorIndex<T, S, 6, 3>
where S: TensorMut<T, 6>,

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 TensorIndex<T, S, 6, 4>
where S: TensorMut<T, 6>,

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 TensorIndex<T, S, 6, 5>
where S: TensorMut<T, 6>,

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 TensorIndex<T, S, 6, 6>
where S: TensorMut<T, 6>,

Source§

fn get_reference_mut(&mut self, indexes: [usize; 0]) -> 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; 0]) -> &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 TensorIndex<T, S, 1, 1>
where S: TensorRef<T, 1>,

Source§

fn get_reference(&self, indexes: [usize; 0]) -> 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); 0]

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; 0]) -> &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 TensorIndex<T, S, 2, 1>
where S: TensorRef<T, 2>,

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 TensorIndex<T, S, 2, 2>
where S: TensorRef<T, 2>,

Source§

fn get_reference(&self, indexes: [usize; 0]) -> 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); 0]

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; 0]) -> &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 TensorIndex<T, S, 3, 1>
where S: TensorRef<T, 3>,

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 TensorIndex<T, S, 3, 2>
where S: TensorRef<T, 3>,

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 TensorIndex<T, S, 3, 3>
where S: TensorRef<T, 3>,

Source§

fn get_reference(&self, indexes: [usize; 0]) -> 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); 0]

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; 0]) -> &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 TensorIndex<T, S, 4, 1>
where S: TensorRef<T, 4>,

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 TensorIndex<T, S, 4, 2>
where S: TensorRef<T, 4>,

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 TensorIndex<T, S, 4, 3>
where S: TensorRef<T, 4>,

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 TensorIndex<T, S, 4, 4>
where S: TensorRef<T, 4>,

Source§

fn get_reference(&self, indexes: [usize; 0]) -> 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); 0]

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; 0]) -> &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 TensorIndex<T, S, 5, 1>
where S: TensorRef<T, 5>,

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 TensorIndex<T, S, 5, 2>
where S: TensorRef<T, 5>,

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 TensorIndex<T, S, 5, 3>
where S: TensorRef<T, 5>,

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 TensorIndex<T, S, 5, 4>
where S: TensorRef<T, 5>,

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 TensorIndex<T, S, 5, 5>
where S: TensorRef<T, 5>,

Source§

fn get_reference(&self, indexes: [usize; 0]) -> 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); 0]

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; 0]) -> &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 TensorIndex<T, S, 6, 1>
where S: TensorRef<T, 6>,

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 TensorIndex<T, S, 6, 2>
where S: TensorRef<T, 6>,

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 TensorIndex<T, S, 6, 3>
where S: TensorRef<T, 6>,

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 TensorIndex<T, S, 6, 4>
where S: TensorRef<T, 6>,

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 TensorIndex<T, S, 6, 5>
where S: TensorRef<T, 6>,

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 TensorIndex<T, S, 6, 6>
where S: TensorRef<T, 6>,

Source§

fn get_reference(&self, indexes: [usize; 0]) -> 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); 0]

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; 0]) -> &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> Freeze for TensorIndex<T, S, D, I>
where S: Freeze,

§

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

§

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

§

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

§

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

§

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

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

Source§

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

Source§

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>,

Source§

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>,

Source§

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.