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 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 mean_axis<const I: isize>(self) -> <Self as Reduce1<I>>::Reduced where
Self: Reduce1<I>,
<Self as HasArrayType>::Array: HasAxis<I>,
pub fn mean_axis<const I: isize>(self) -> <Self as Reduce1<I>>::Reduced where
Self: Reduce1<I>,
<Self as HasArrayType>::Array: HasAxis<I>,
Calls mean_axis() on self
.
sourceimpl<const M: usize, H: Tape> Tensor1D<M, H>
impl<const M: usize, H: Tape> Tensor1D<M, H>
sourcepub fn normalize_axis<const I: isize>(self, epsilon: f32) -> Self where
Self: Reduce1<I>,
<Self as HasArrayType>::Array: HasAxis<I>,
pub fn normalize_axis<const I: isize>(self, epsilon: f32) -> Self where
Self: Reduce1<I>,
<Self as HasArrayType>::Array: HasAxis<I>,
Calls normalize_axis() 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 Reduce1<{ _ }>>::Reduced
pub fn logsumexp(self) -> <Self as Reduce1<{ _ }>>::Reduced
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_axis<const I: isize>(
self,
epsilon: f32
) -> <Self as Reduce1<I>>::Reduced where
Self: Reduce1<I>,
<Self as HasArrayType>::Array: HasAxis<I>,
pub fn std_axis<const I: isize>(
self,
epsilon: f32
) -> <Self as Reduce1<I>>::Reduced where
Self: Reduce1<I>,
<Self as HasArrayType>::Array: HasAxis<I>,
Calls std_axis() on self
.
sourcepub fn var_axis<const I: isize>(self) -> <Self as Reduce1<I>>::Reduced where
Self: Reduce1<I>,
<Self as HasArrayType>::Array: HasAxis<I>,
pub fn var_axis<const I: isize>(self) -> <Self as Reduce1<I>>::Reduced where
Self: Reduce1<I>,
<Self as HasArrayType>::Array: HasAxis<I>,
Calls var_axis() on self
.
Trait Implementations
sourceimpl<const M: usize, H: Tape> Broadcast1<Tensor1D<M, H>, -1> for Tensor0D<H>
impl<const M: usize, H: Tape> Broadcast1<Tensor1D<M, H>, -1> for Tensor0D<H>
sourcefn broadcast1(self) -> Tensor1D<M, H>
fn broadcast1(self) -> Tensor1D<M, H>
Broadcast self
into T
, increasing number dimensions by 1.
sourceimpl<const M: usize, const N: usize, H: Tape> Broadcast1<Tensor2D<M, N, H>, -1> for Tensor1D<M, H>
impl<const M: usize, const N: usize, H: Tape> Broadcast1<Tensor2D<M, N, H>, -1> for Tensor1D<M, H>
sourcefn broadcast1(self) -> Tensor2D<M, N, H>
fn broadcast1(self) -> Tensor2D<M, N, H>
Broadcast self
into T
, increasing number dimensions by 1.
sourceimpl<const M: usize, const N: usize, H: Tape> Broadcast1<Tensor2D<M, N, H>, 0> for Tensor1D<N, H>
impl<const M: usize, const N: usize, H: Tape> Broadcast1<Tensor2D<M, N, H>, 0> for Tensor1D<N, H>
sourcefn broadcast1(self) -> Tensor2D<M, N, H>
fn broadcast1(self) -> Tensor2D<M, N, H>
Broadcast self
into T
, increasing number dimensions by 1.
sourceimpl<const M: usize, const N: usize, const O: usize, H: Tape> Broadcast2<Tensor3D<M, N, O, H>, 0, 1> for Tensor1D<O, H>
impl<const M: usize, const N: usize, const O: usize, H: Tape> Broadcast2<Tensor3D<M, N, O, H>, 0, 1> for Tensor1D<O, H>
sourcefn broadcast2(self) -> Tensor3D<M, N, O, H>
fn broadcast2(self) -> Tensor3D<M, N, O, H>
Broadcast self
into T
, increasing number dimensions by 2.
sourceimpl<const M: usize, const N: usize, const O: usize, H: Tape> Broadcast2<Tensor3D<M, N, O, H>, 0, 2> for Tensor1D<N, H>
impl<const M: usize, const N: usize, const O: usize, H: Tape> Broadcast2<Tensor3D<M, N, O, H>, 0, 2> for Tensor1D<N, H>
sourcefn broadcast2(self) -> Tensor3D<M, N, O, H>
fn broadcast2(self) -> Tensor3D<M, N, O, H>
Broadcast self
into T
, increasing number dimensions by 2.
sourceimpl<const M: usize, const N: usize, const O: usize, H: Tape> Broadcast2<Tensor3D<M, N, O, H>, 1, 2> for Tensor1D<M, H>
impl<const M: usize, const N: usize, const O: usize, H: Tape> Broadcast2<Tensor3D<M, N, O, H>, 1, 2> for Tensor1D<M, H>
sourcefn broadcast2(self) -> Tensor3D<M, N, O, H>
fn broadcast2(self) -> Tensor3D<M, N, O, H>
Broadcast self
into T
, increasing number dimensions by 2.
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Broadcast3<Tensor4D<M, N, O, P, H>, 0, 1, 2> for Tensor1D<P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Broadcast3<Tensor4D<M, N, O, P, H>, 0, 1, 2> for Tensor1D<P, H>
sourcefn broadcast3(self) -> Tensor4D<M, N, O, P, H>
fn broadcast3(self) -> Tensor4D<M, N, O, P, H>
Broadcast self
into T
, increasing number dimensions by 3.
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Broadcast3<Tensor4D<M, N, O, P, H>, 0, 1, 3> for Tensor1D<O, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Broadcast3<Tensor4D<M, N, O, P, H>, 0, 1, 3> for Tensor1D<O, H>
sourcefn broadcast3(self) -> Tensor4D<M, N, O, P, H>
fn broadcast3(self) -> Tensor4D<M, N, O, P, H>
Broadcast self
into T
, increasing number dimensions by 3.
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Broadcast3<Tensor4D<M, N, O, P, H>, 0, 2, 3> for Tensor1D<N, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Broadcast3<Tensor4D<M, N, O, P, H>, 0, 2, 3> for Tensor1D<N, H>
sourcefn broadcast3(self) -> Tensor4D<M, N, O, P, H>
fn broadcast3(self) -> Tensor4D<M, N, O, P, H>
Broadcast self
into T
, increasing number dimensions by 3.
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Broadcast3<Tensor4D<M, N, O, P, H>, 1, 2, 3> for Tensor1D<M, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Broadcast3<Tensor4D<M, N, O, P, H>, 1, 2, 3> for Tensor1D<M, H>
sourcefn broadcast3(self) -> Tensor4D<M, N, O, P, H>
fn broadcast3(self) -> Tensor4D<M, N, O, P, H>
Broadcast self
into T
, increasing number dimensions by 3.
sourceimpl<const M: usize, H> HasArrayData for Tensor1D<M, H>
impl<const M: usize, H> HasArrayData for Tensor1D<M, H>
sourceimpl<const I: usize, const O: usize, H: Tape> Module<Tensor1D<I, H>> for Linear<I, O>
impl<const I: usize, const O: usize, H: Tape> Module<Tensor1D<I, H>> for Linear<I, O>
sourcefn forward_mut(&mut self, input: Input) -> Self::Output
fn forward_mut(&mut self, input: Input) -> Self::Output
Pass an Input
through the unit and produce Self::Output.
Can be implemented for multiple Input
types. Read more
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_axis::<-1>()] with Self::epsilon
- mul() with Self::gamma
- add() with Self::beta
sourcefn forward_mut(&mut self, input: Input) -> Self::Output
fn forward_mut(&mut self, input: Input) -> Self::Output
Pass an Input
through the unit and produce Self::Output.
Can be implemented for multiple Input
types. Read more
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 A: usize, H: Tape> Reshape<Tensor0D<H>> for Tensor1D<A, H> where
Assert<{ _ }>: ConstTrue,
impl<const A: usize, H: Tape> Reshape<Tensor0D<H>> for Tensor1D<A, H> where
Assert<{ _ }>: ConstTrue,
sourceimpl<const M: usize, H: Tape> Reshape<Tensor1D<M, H>> for Tensor0D<H> where
Assert<{ _ }>: ConstTrue,
impl<const M: usize, H: Tape> Reshape<Tensor1D<M, H>> for Tensor0D<H> where
Assert<{ _ }>: ConstTrue,
sourceimpl<const A: usize, const M: usize, H: Tape> Reshape<Tensor1D<M, H>> for Tensor1D<A, H> where
Assert<{ _ }>: ConstTrue,
impl<const A: usize, const M: usize, H: Tape> Reshape<Tensor1D<M, H>> for Tensor1D<A, H> where
Assert<{ _ }>: ConstTrue,
sourceimpl<const A: usize, const B: usize, const M: usize, H: Tape> Reshape<Tensor1D<M, H>> for Tensor2D<A, B, H> where
Assert<{ _ }>: ConstTrue,
impl<const A: usize, const B: usize, const M: usize, H: Tape> Reshape<Tensor1D<M, H>> for Tensor2D<A, B, H> where
Assert<{ _ }>: ConstTrue,
sourceimpl<const A: usize, const B: usize, const C: usize, const M: usize, H: Tape> Reshape<Tensor1D<M, H>> for Tensor3D<A, B, C, H> where
Assert<{ _ }>: ConstTrue,
impl<const A: usize, const B: usize, const C: usize, const M: usize, H: Tape> Reshape<Tensor1D<M, H>> for Tensor3D<A, B, C, H> where
Assert<{ _ }>: ConstTrue,
sourceimpl<const A: usize, const B: usize, const C: usize, const D: usize, const M: usize, H: Tape> Reshape<Tensor1D<M, H>> for Tensor4D<A, B, C, D, H> where
Assert<{ _ }>: ConstTrue,
impl<const A: usize, const B: usize, const C: usize, const D: usize, const M: usize, H: Tape> Reshape<Tensor1D<M, H>> for Tensor4D<A, B, C, D, H> where
Assert<{ _ }>: ConstTrue,
sourceimpl<const A: usize, const M: usize, const N: usize, H: Tape> Reshape<Tensor2D<M, N, H>> for Tensor1D<A, H> where
Assert<{ _ }>: ConstTrue,
impl<const A: usize, const M: usize, const N: usize, H: Tape> Reshape<Tensor2D<M, N, H>> for Tensor1D<A, H> where
Assert<{ _ }>: ConstTrue,
sourceimpl<const A: usize, const M: usize, const N: usize, const O: usize, H: Tape> Reshape<Tensor3D<M, N, O, H>> for Tensor1D<A, H> where
Assert<{ _ }>: ConstTrue,
impl<const A: usize, const M: usize, const N: usize, const O: usize, H: Tape> Reshape<Tensor3D<M, N, O, H>> for Tensor1D<A, H> where
Assert<{ _ }>: ConstTrue,
sourceimpl<const A: usize, const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Reshape<Tensor4D<M, N, O, P, H>> for Tensor1D<A, H> where
Assert<{ _ }>: ConstTrue,
impl<const A: usize, const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Reshape<Tensor4D<M, N, O, P, H>> for Tensor1D<A, H> where
Assert<{ _ }>: ConstTrue,
sourceimpl<const M: usize, H: Tape> Select1<Tensor0D<H>, -1> for Tensor1D<M, H>
impl<const M: usize, H: Tape> Select1<Tensor0D<H>, -1> for Tensor1D<M, H>
type Indices = usize
sourcefn select(self, indices: &Self::Indices) -> Tensor0D<H>
fn select(self, indices: &Self::Indices) -> Tensor0D<H>
Select sub elements using Self::Indices. The same element can be selected multiple times depending on Self::Indices. Read more
sourceimpl<const M: usize, const N: usize, H: Tape> Select1<Tensor1D<M, H>, -1> for Tensor2D<M, N, H>
impl<const M: usize, const N: usize, H: Tape> Select1<Tensor1D<M, H>, -1> for Tensor2D<M, N, H>
sourceimpl<const M: usize, const N: usize, H: Tape> Select1<Tensor1D<N, H>, 0> for Tensor2D<M, N, H>
impl<const M: usize, const N: usize, H: Tape> Select1<Tensor1D<N, H>, 0> for Tensor2D<M, N, H>
type Indices = usize
sourcefn select(self, indices: &Self::Indices) -> Tensor1D<N, H>
fn select(self, indices: &Self::Indices) -> Tensor1D<N, H>
Select sub elements using Self::Indices. The same element can be selected multiple times depending on Self::Indices. Read more
sourceimpl<const M: usize, H: Tape> Tensor for Tensor1D<M, H>
impl<const M: usize, H: Tape> Tensor for Tensor1D<M, H>
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 = NoneTape> !Send for Tensor1D<N, Tape>
impl<const N: usize, Tape = NoneTape> !Sync for Tensor1D<N, Tape>
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
sourceimpl<T> CanUpdateWithGradients for T where
T: Tensor<Dtype = f32>,
impl<T> CanUpdateWithGradients for T where
T: Tensor<Dtype = f32>,
sourcefn update<G>(&mut self, grads: &mut G, unused: &mut UnusedTensors) where
G: GradientProvider,
fn update<G>(&mut self, grads: &mut G, unused: &mut UnusedTensors) where
G: GradientProvider,
Subtracts the gradient for the tensor from HasArrayData::mut_data.