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, 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 normalize<Axes>(self, epsilon: f32) -> Selfwhere
Self: Reduce<Axes>,
<Self as HasArrayType>::Array: HasAxes<Axes>,
pub fn normalize<Axes>(self, epsilon: f32) -> Selfwhere
Self: Reduce<Axes>,
<Self as HasArrayType>::Array: HasAxes<Axes>,
Calls normalize()
sourceimpl<const M: usize, H: Tape> Tensor1D<M, H>
impl<const M: usize, H: Tape> Tensor1D<M, H>
sourcepub fn logsumexp<T, Axes>(self) -> Twhere
Self: ReduceTo<T, Axes>,
pub fn logsumexp<T, Axes>(self) -> Twhere
Self: ReduceTo<T, Axes>,
Calls logsumexp() on self
with Axes
.
sourcepub fn log_softmax<Axes>(self) -> Selfwhere
Self: Reduce<Axes>,
pub fn log_softmax<Axes>(self) -> Selfwhere
Self: Reduce<Axes>,
Calls log_softmax() on self
with Axes
Trait Implementations
sourceimpl<const N: usize, TapeL: Tape, TapeR: Tape> Add<Tensor1D<N, TapeR>> for Tensor1D<N, TapeL>where
TapeL: Merge<TapeR>,
impl<const N: usize, TapeL: Tape, TapeR: Tape> Add<Tensor1D<N, TapeR>> for Tensor1D<N, TapeL>where
TapeL: Merge<TapeR>,
sourceimpl<const M: usize, const N: usize, H: Tape> BroadcastTo<Tensor2D<M, N, H>, Axis<0>> for Tensor1D<N, H>
impl<const M: usize, const N: usize, H: Tape> BroadcastTo<Tensor2D<M, N, H>, Axis<0>> for Tensor1D<N, H>
sourceimpl<const M: usize, const N: usize, H: Tape> BroadcastTo<Tensor2D<M, N, H>, Axis<1>> for Tensor1D<M, H>
impl<const M: usize, const N: usize, H: Tape> BroadcastTo<Tensor2D<M, N, H>, Axis<1>> for Tensor1D<M, H>
sourceimpl<const M: usize, const N: usize, const O: usize, H: Tape> BroadcastTo<Tensor3D<M, N, O, H>, (Axis<0>, Axis<1>)> for Tensor1D<O, H>
impl<const M: usize, const N: usize, const O: usize, H: Tape> BroadcastTo<Tensor3D<M, N, O, H>, (Axis<0>, Axis<1>)> for Tensor1D<O, H>
sourceimpl<const M: usize, const N: usize, const O: usize, H: Tape> BroadcastTo<Tensor3D<M, N, O, H>, (Axis<0>, Axis<2>)> for Tensor1D<N, H>
impl<const M: usize, const N: usize, const O: usize, H: Tape> BroadcastTo<Tensor3D<M, N, O, H>, (Axis<0>, Axis<2>)> for Tensor1D<N, H>
sourceimpl<const M: usize, const N: usize, const O: usize, H: Tape> BroadcastTo<Tensor3D<M, N, O, H>, (Axis<1>, Axis<2>)> for Tensor1D<M, H>
impl<const M: usize, const N: usize, const O: usize, H: Tape> BroadcastTo<Tensor3D<M, N, O, H>, (Axis<1>, Axis<2>)> for Tensor1D<M, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> BroadcastTo<Tensor4D<M, N, O, P, H>, (Axis<0>, Axis<1>, Axis<2>)> for Tensor1D<P, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> BroadcastTo<Tensor4D<M, N, O, P, H>, (Axis<0>, Axis<1>, Axis<2>)> for Tensor1D<P, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> BroadcastTo<Tensor4D<M, N, O, P, H>, (Axis<0>, Axis<1>, Axis<3>)> for Tensor1D<O, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> BroadcastTo<Tensor4D<M, N, O, P, H>, (Axis<0>, Axis<1>, Axis<3>)> for Tensor1D<O, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> BroadcastTo<Tensor4D<M, N, O, P, H>, (Axis<0>, Axis<2>, Axis<3>)> for Tensor1D<N, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> BroadcastTo<Tensor4D<M, N, O, P, H>, (Axis<0>, Axis<2>, Axis<3>)> for Tensor1D<N, H>
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> BroadcastTo<Tensor4D<M, N, O, P, H>, (Axis<1>, Axis<2>, Axis<3>)> for Tensor1D<M, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> BroadcastTo<Tensor4D<M, N, O, P, H>, (Axis<1>, Axis<2>, Axis<3>)> for Tensor1D<M, H>
sourceimpl<const N: usize, TapeL: Tape, TapeR: Tape> Div<Tensor1D<N, TapeR>> for Tensor1D<N, TapeL>where
TapeL: Merge<TapeR>,
impl<const N: usize, TapeL: Tape, TapeR: Tape> Div<Tensor1D<N, TapeR>> for Tensor1D<N, TapeL>where
TapeL: Merge<TapeR>,
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 N: usize, TapeL: Tape, TapeR: Tape> Mul<Tensor1D<N, TapeR>> for Tensor1D<N, TapeL>where
TapeL: Merge<TapeR>,
impl<const N: usize, TapeL: Tape, TapeR: Tape> Mul<Tensor1D<N, TapeR>> for Tensor1D<N, TapeL>where
TapeL: Merge<TapeR>,
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> SelectTo<Tensor0D<H>, Axis<0>> for Tensor1D<M, H>
impl<const M: usize, H: Tape> SelectTo<Tensor0D<H>, Axis<0>> 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> SelectTo<Tensor1D<M, H>, Axis<1>> for Tensor2D<M, N, H>
impl<const M: usize, const N: usize, H: Tape> SelectTo<Tensor1D<M, H>, Axis<1>> for Tensor2D<M, N, H>
type Indices = [usize; M]
sourcefn select(self, indices: &Self::Indices) -> Tensor1D<M, H>
fn select(self, indices: &Self::Indices) -> Tensor1D<M, 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> SelectTo<Tensor1D<N, H>, Axis<0>> for Tensor2D<M, N, H>
impl<const M: usize, const N: usize, H: Tape> SelectTo<Tensor1D<N, H>, Axis<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, const Z: usize, H: Tape> SelectTo<Tensor1D<Z, H>, Axis<0>> for Tensor1D<M, H>
impl<const M: usize, const Z: usize, H: Tape> SelectTo<Tensor1D<Z, H>, Axis<0>> for Tensor1D<M, H>
type Indices = [usize; Z]
sourcefn select(self, indices: &Self::Indices) -> Tensor1D<Z, H>
fn select(self, indices: &Self::Indices) -> Tensor1D<Z, 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 B: usize, const Z: usize, H: Tape> SelectTo<Tensor2D<B, Z, H>, Axis<0>> for Tensor1D<M, H>
impl<const M: usize, const B: usize, const Z: usize, H: Tape> SelectTo<Tensor2D<B, Z, H>, Axis<0>> for Tensor1D<M, H>
sourceimpl<const N: usize, TapeL: Tape, TapeR: Tape> Sub<Tensor1D<N, TapeR>> for Tensor1D<N, TapeL>where
TapeL: Merge<TapeR>,
impl<const N: usize, TapeL: Tape, TapeR: Tape> Sub<Tensor1D<N, TapeR>> for Tensor1D<N, TapeL>where
TapeL: Merge<TapeR>,
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.
sourcefn with_empty_tape(&self) -> Self
fn with_empty_tape(&self) -> Self
Clones self and initializes a new empty tape.
sourceimpl<const M: usize> TensorCreator for Tensor1D<M, NoneTape>
impl<const M: usize> TensorCreator for Tensor1D<M, NoneTape>
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.impl<const M: usize, H: Tape> ReduceTo<Tensor0D<H>, AllAxes> for Tensor1D<M, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> ReduceTo<Tensor1D<M, H>, (Axis<1>, Axis<2>, Axis<3>)> for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, H: Tape> ReduceTo<Tensor1D<M, H>, (Axis<1>, Axis<2>)> for Tensor3D<M, N, O, H>
impl<const M: usize, const N: usize, H: Tape> ReduceTo<Tensor1D<M, H>, Axis<1>> for Tensor2D<M, N, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> ReduceTo<Tensor1D<N, H>, (Axis<0>, Axis<2>, Axis<3>)> for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, H: Tape> ReduceTo<Tensor1D<N, H>, (Axis<0>, Axis<2>)> for Tensor3D<M, N, O, H>
impl<const M: usize, const N: usize, H: Tape> ReduceTo<Tensor1D<N, H>, Axis<0>> for Tensor2D<M, N, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> ReduceTo<Tensor1D<O, H>, (Axis<0>, Axis<1>, Axis<3>)> for Tensor4D<M, N, O, P, H>
impl<const M: usize, const N: usize, const O: usize, H: Tape> ReduceTo<Tensor1D<O, H>, (Axis<0>, Axis<1>)> for Tensor3D<M, N, O, H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> ReduceTo<Tensor1D<P, H>, (Axis<0>, Axis<1>, Axis<2>)> for Tensor4D<M, N, O, P, H>
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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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 Twhere
T: Tensor<Dtype = f32>,
impl<T> CanUpdateWithGradients for Twhere
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.