pub struct Tensor4D<const M: usize, const N: usize, const O: usize, const P: usize, Tape = NoTape> { /* private fields */ }
Expand description
A 4d [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, OwnsTape>
impl<const M: usize, const N: usize, const O: usize, const P: usize> Tensor4D<M, N, O, P, OwnsTape>
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> Tensor4D<M, N, O, P, NoTape>
impl<const M: usize, const N: usize, const O: usize, const P: usize> Tensor4D<M, N, O, P, NoTape>
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>
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, NoTape>, value: f32) -> Self
pub fn value_mask(self, mask: &Tensor4D<M, N, O, P, NoTape>, 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>
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>
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, H>> for &Tensor4D<M, N, O, P, NoTape>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Add<Tensor4D<M, N, O, P, H>> for &Tensor4D<M, N, O, P, NoTape>
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, Tape: Clone> Clone for Tensor4D<M, N, O, P, Tape>
impl<const M: usize, const N: usize, const O: usize, const P: usize, Tape: Clone> Clone for Tensor4D<M, N, O, P, Tape>
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, NoTape>
impl<const M: usize, const N: usize, const O: usize, const P: usize> Default for Tensor4D<M, N, O, P, NoTape>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Div<Tensor4D<M, N, O, P, H>> for &Tensor4D<M, N, O, P, NoTape>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Div<Tensor4D<M, N, O, P, H>> for &Tensor4D<M, N, O, P, NoTape>
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, H>> for &Tensor4D<M, N, O, P, NoTape>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Mul<Tensor4D<M, N, O, P, H>> for &Tensor4D<M, N, O, P, NoTape>
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, H>> for &Tensor4D<M, N, O, P, NoTape>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Sub<Tensor4D<M, N, O, P, H>> for &Tensor4D<M, N, O, P, NoTape>
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<Tensor4D<M, N, O, P, NoTape>> 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, NoTape>> for Tensor4D<M, N, O, P, H>
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>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize> TensorCreator for Tensor4D<M, N, O, P, NoTape>
impl<const M: usize, const N: usize, const O: usize, const P: usize> TensorCreator for Tensor4D<M, N, O, P, NoTape>
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 from [unique_id()].
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