pub struct Tensor4D<const M: usize, const N: usize, const O: usize, const P: usize, Tape = NoneTape> { /* private fields */ }
Expand description
A 4d super::Tensor with shape (M, N, O, P). Backed by data [[[[f32; P]; O]; N]; M]
.
Implementations
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize> Tensor4D<M, N, O, P, NoneTape>
impl<const M: usize, const N: usize, const O: usize, const P: usize> Tensor4D<M, N, O, P, NoneTape>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize> Tensor4D<M, N, O, P, OwnedTape>
impl<const M: usize, const N: usize, const O: usize, const P: usize> Tensor4D<M, N, O, P, OwnedTape>
sourcepub fn backward(self) -> Gradients
pub fn backward(self) -> Gradients
Calls backward() on self
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourcepub fn gather_last_dim(
self,
indices: &[[[usize; O]; N]; M]
) -> <Self as Tensor>::LastDimReduced
pub fn gather_last_dim(
self,
indices: &[[[usize; O]; N]; M]
) -> <Self as Tensor>::LastDimReduced
Calls gather_last_dim() on self
.
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourcepub fn value_mask(self, mask: &Tensor4D<M, N, O, P, NoneTape>, value: f32) -> Self
pub fn value_mask(self, mask: &Tensor4D<M, N, O, P, NoneTape>, value: f32) -> Self
Calls value_mask() on self
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourcepub fn max_last_dim(self) -> <Self as Tensor>::LastDimReduced
pub fn max_last_dim(self) -> <Self as Tensor>::LastDimReduced
Calls max_last_dim() on self
.
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourcepub fn mean_last_dim(self) -> <Self as Tensor>::LastDimReduced
pub fn mean_last_dim(self) -> <Self as Tensor>::LastDimReduced
Calls mean_last_dim() on self
.
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourcepub fn normalize(self, epsilon: f32) -> Self
pub fn normalize(self, epsilon: f32) -> Self
Calls normalize() on self
.
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourcepub fn logsumexp(self) -> <Self as Tensor>::LastDimReduced
pub fn logsumexp(self) -> <Self as Tensor>::LastDimReduced
Calls logsumexp() on self
.
sourcepub fn log_softmax(self) -> Self
pub fn log_softmax(self) -> Self
Calls log_softmax() on self
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourcepub fn std_last_dim(self) -> <Self as Tensor>::LastDimReduced
pub fn std_last_dim(self) -> <Self as Tensor>::LastDimReduced
Calls std_last_dim() on self
.
sourcepub fn var_last_dim(self) -> <Self as Tensor>::LastDimReduced
pub fn var_last_dim(self) -> <Self as Tensor>::LastDimReduced
Calls var_last_dim() on self
.
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor4D<M, N, O, P, H>
sourcepub fn sum_last_dim(self) -> <Self as Tensor>::LastDimReduced
pub fn sum_last_dim(self) -> <Self as Tensor>::LastDimReduced
Calls sum_last_dim() on self
.
Trait Implementations
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Add<&Tensor4D<M, N, O, P, NoneTape>> for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Add<&Tensor4D<M, N, O, P, NoneTape>> for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Add<Tensor4D<M, N, O, P, H>> for f32
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Add<Tensor4D<M, N, O, P, H>> for f32
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Add<f32> for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Add<f32> for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Clone> Clone for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Clone> Clone for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, Tape: Debug> Debug for Tensor4D<M, N, O, P, Tape>
impl<const M: usize, const N: usize, const O: usize, const P: usize, Tape: Debug> Debug for Tensor4D<M, N, O, P, Tape>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize> Default for Tensor4D<M, N, O, P, NoneTape>
impl<const M: usize, const N: usize, const O: usize, const P: usize> Default for Tensor4D<M, N, O, P, NoneTape>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Div<&Tensor4D<M, N, O, P, NoneTape>> for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Div<&Tensor4D<M, N, O, P, NoneTape>> for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Div<f32> for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Div<f32> for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H> HasArrayData for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H> HasArrayData for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H> HasArrayType for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H> HasArrayType for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H> HasDevice for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H> HasDevice for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H> HasUniqueId for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H> HasUniqueId for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Mul<&Tensor4D<M, N, O, P, NoneTape>> for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Mul<&Tensor4D<M, N, O, P, NoneTape>> for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Mul<Tensor4D<M, N, O, P, H>> for f32
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Mul<Tensor4D<M, N, O, P, H>> for f32
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Mul<f32> for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Mul<f32> for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Neg for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Neg for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, HIn, HOut> PutTape<HOut> for Tensor4D<M, N, O, P, HIn> where
HIn: Tape,
HOut: Tape,
impl<const M: usize, const N: usize, const O: usize, const P: usize, HIn, HOut> PutTape<HOut> for Tensor4D<M, N, O, P, HIn> where
HIn: Tape,
HOut: Tape,
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H> Randomize<f32> for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H> Randomize<f32> for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Sub<&Tensor4D<M, N, O, P, NoneTape>> for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Sub<&Tensor4D<M, N, O, P, NoneTape>> for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Sub<Tensor4D<M, N, O, P, H>> for f32
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Sub<Tensor4D<M, N, O, P, H>> for f32
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Sub<f32> for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Sub<f32> for Tensor4D<M, N, O, P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Tensor for Tensor4D<M, N, O, P, H>
type LastDimReduced = Tensor3D<M, N, O, H>
type LastDimReduced = Tensor3D<M, N, O, H>
This tensor but with it’s last dimension reduced to 1. See ReduceLastDim.
type ReducingIndices = [[[usize; O]; N]; M]
type ReducingIndices = [[[usize; O]; N]; M]
Indices used for gather_last_dim() that can reduce this tensor to it’s Tensor::LastDimReduced.
sourcefn split_tape(self) -> (Self::NoTape, Self::Tape)
fn split_tape(self) -> (Self::NoTape, Self::Tape)
Removes whatever Tape this tensor has and returns itself without a tape.
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize> TensorCreator for Tensor4D<M, N, O, P, NoneTape>
impl<const M: usize, const N: usize, const O: usize, const P: usize> TensorCreator for Tensor4D<M, N, O, P, NoneTape>
sourcefn new_boxed(data: Box<Self::Array>) -> Self
fn new_boxed(data: Box<Self::Array>) -> Self
Returns a new object with data
and a new UniqueId.
sourcefn new(data: Self::Array) -> Self
fn new(data: Self::Array) -> Self
Create a new tensor with Self::Array
on the stack. This just boxes Self::Array
and calls TensorCreator::new_boxed.
sourcefn rand<R: Rng>(rng: &mut R) -> Self where
Standard: Distribution<Self::Dtype>,
fn rand<R: Rng>(rng: &mut R) -> Self where
Standard: Distribution<Self::Dtype>,
Creates a tensor filled with values sampled from Standard distribution.
sourcefn randn<R: Rng>(rng: &mut R) -> Self where
StandardNormal: Distribution<Self::Dtype>,
fn randn<R: Rng>(rng: &mut R) -> Self where
StandardNormal: Distribution<Self::Dtype>,
Creates a tensor filled with values sampled from StandardNormal distribution.
Auto Trait Implementations
impl<const M: usize, const N: usize, const O: usize, const P: usize, Tape> RefUnwindSafe for Tensor4D<M, N, O, P, Tape> where
Tape: RefUnwindSafe,
impl<const M: usize, const N: usize, const O: usize, const P: usize, Tape> Send for Tensor4D<M, N, O, P, Tape> where
Tape: Send,
impl<const M: usize, const N: usize, const O: usize, const P: usize, Tape> Sync for Tensor4D<M, N, O, P, Tape> where
Tape: Sync,
impl<const M: usize, const N: usize, const O: usize, const P: usize, Tape> Unpin for Tensor4D<M, N, O, P, Tape> where
Tape: Unpin,
impl<const M: usize, const N: usize, const O: usize, const P: usize, Tape> UnwindSafe for Tensor4D<M, N, O, P, Tape> where
Tape: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more