Expand description
A 1d super::Tensor with shape (M, ). Backed by data [f32; M]
.
Implementations
sourceimpl<const M: usize> Tensor1D<M, NoneTape>
impl<const M: usize> Tensor1D<M, NoneTape>
sourceimpl<const M: usize> Tensor1D<M, OwnedTape>
impl<const M: usize> Tensor1D<M, OwnedTape>
sourcepub fn backward(self) -> Gradients
pub fn backward(self) -> Gradients
Calls backward() on self
sourceimpl<const M: usize, H: Tape> Tensor1D<M, H>
impl<const M: usize, H: Tape> Tensor1D<M, H>
sourcepub fn gather_last_dim(self, indices: &usize) -> <Self as Tensor>::LastDimReduced
pub fn gather_last_dim(self, indices: &usize) -> <Self as Tensor>::LastDimReduced
Calls gather_last_dim() on self
.
sourceimpl<const M: usize, H: Tape> Tensor1D<M, H>
impl<const M: usize, H: Tape> Tensor1D<M, H>
sourcepub fn value_mask(self, mask: &Tensor1D<M, NoneTape>, value: f32) -> Self
pub fn value_mask(self, mask: &Tensor1D<M, NoneTape>, value: f32) -> Self
Calls value_mask() on self
sourceimpl<const M: usize, H: Tape> Tensor1D<M, H>
impl<const M: usize, H: Tape> Tensor1D<M, 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, H: Tape> Tensor1D<M, H>
impl<const M: usize, H: Tape> Tensor1D<M, 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, H: Tape> Tensor1D<M, H>
impl<const M: usize, H: Tape> Tensor1D<M, H>
sourcepub fn normalize(self, epsilon: f32) -> Self
pub fn normalize(self, epsilon: f32) -> Self
Calls normalize() on self
.
sourceimpl<const M: usize, H: Tape> Tensor1D<M, H>
impl<const M: usize, H: Tape> Tensor1D<M, 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, H: Tape> Tensor1D<M, H>
impl<const M: usize, H: Tape> Tensor1D<M, 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, H: Tape> Tensor1D<M, H>
impl<const M: usize, H: Tape> Tensor1D<M, 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, H> HasArrayData for Tensor1D<M, H>
impl<const M: usize, H> HasArrayData for Tensor1D<M, H>
sourceimpl<H: Tape, const M: usize> Module<Tensor1D<M, H>> for LayerNorm1D<M>
impl<H: Tape, const M: usize> Module<Tensor1D<M, H>> for LayerNorm1D<M>
sourcefn forward(&self, x: Tensor1D<M, H>) -> Self::Output
fn forward(&self, x: Tensor1D<M, H>) -> Self::Output
Calls:
- normalize() with Self::epsilon
- mul() with Self::gamma
- add() with Self::beta
sourceimpl<const M: usize, HIn, HOut> PutTape<HOut> for Tensor1D<M, HIn> where
HIn: Tape,
HOut: Tape,
impl<const M: usize, HIn, HOut> PutTape<HOut> for Tensor1D<M, HIn> where
HIn: Tape,
HOut: Tape,
sourceimpl<const M: usize, H: Tape> Tensor for Tensor1D<M, H>
impl<const M: usize, H: Tape> Tensor for Tensor1D<M, H>
type LastDimReduced = Tensor0D<H>
type LastDimReduced = Tensor0D<H>
This tensor but with it’s last dimension reduced to 1. See ReduceLastDim.
type ReducingIndices = usize
type ReducingIndices = usize
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> TensorCreator for Tensor1D<M, NoneTape>
impl<const M: usize> TensorCreator for Tensor1D<M, 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 N: usize, Tape> RefUnwindSafe for Tensor1D<N, Tape> where
Tape: RefUnwindSafe,
impl<const N: usize, Tape> Send for Tensor1D<N, Tape> where
Tape: Send,
impl<const N: usize, Tape> Sync for Tensor1D<N, Tape> where
Tape: Sync,
impl<const N: usize, Tape> Unpin for Tensor1D<N, Tape> where
Tape: Unpin,
impl<const N: usize, Tape> UnwindSafe for Tensor1D<N, 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