pub struct Tensor0D<Tape = NoneTape> { /* private fields */ }
Expand description
A 0d super::Tensor with shape (). Backed by data f32
.
Implementations
sourceimpl Tensor0D<NoneTape>
impl Tensor0D<NoneTape>
sourceimpl<H: Tape> Tensor0D<H>
impl<H: Tape> Tensor0D<H>
sourcepub fn value_mask(self, mask: &Tensor0D<NoneTape>, value: f32) -> Self
pub fn value_mask(self, mask: &Tensor0D<NoneTape>, value: f32) -> Self
Calls value_mask() on self
sourceimpl<H: Tape> Tensor0D<H>
impl<H: Tape> Tensor0D<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<H: Tape> Tensor0D<H>
impl<H: Tape> Tensor0D<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<H: Tape> Tensor0D<H>
impl<H: Tape> Tensor0D<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
Trait Implementations
sourceimpl<H: Tape> Broadcast1<Tensor0D<H>, -1> for Tensor0D<H>
impl<H: Tape> Broadcast1<Tensor0D<H>, -1> for Tensor0D<H>
sourcefn broadcast1(self) -> Tensor0D<H>
fn broadcast1(self) -> Tensor0D<H>
Broadcast self
into T
, increasing number dimensions by 1.
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> Broadcast2<Tensor2D<M, N, H>, 0, 1> for Tensor0D<H>
impl<const M: usize, const N: usize, H: Tape> Broadcast2<Tensor2D<M, N, H>, 0, 1> for Tensor0D<H>
sourcefn broadcast2(self) -> Tensor2D<M, N, H>
fn broadcast2(self) -> Tensor2D<M, N, H>
Broadcast self
into T
, increasing number dimensions by 2.
sourceimpl<const M: usize, const N: usize, const O: usize, H: Tape> Broadcast3<Tensor3D<M, N, O, H>, 0, 1, 2> for Tensor0D<H>
impl<const M: usize, const N: usize, const O: usize, H: Tape> Broadcast3<Tensor3D<M, N, O, H>, 0, 1, 2> for Tensor0D<H>
sourcefn broadcast3(self) -> Tensor3D<M, N, O, H>
fn broadcast3(self) -> Tensor3D<M, N, O, 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> Broadcast4<Tensor4D<M, N, O, P, H>, 0, 1, 2, 3> for Tensor0D<H>
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Broadcast4<Tensor4D<M, N, O, P, H>, 0, 1, 2, 3> for Tensor0D<H>
sourcefn broadcast4(self) -> Tensor4D<M, N, O, P, H>
fn broadcast4(self) -> Tensor4D<M, N, O, P, H>
Broadcast self
into T
, increasing number dimensions by 4.
sourceimpl<H> HasArrayData for Tensor0D<H>
impl<H> HasArrayData for Tensor0D<H>
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 A: usize, const B: usize, H: Tape> Reshape<Tensor0D<H>> for Tensor2D<A, B, H> where
Assert<{ _ }>: ConstTrue,
impl<const A: usize, const B: usize, H: Tape> Reshape<Tensor0D<H>> for Tensor2D<A, B, H> where
Assert<{ _ }>: ConstTrue,
sourceimpl<const A: usize, const B: usize, const C: usize, H: Tape> Reshape<Tensor0D<H>> for Tensor3D<A, B, C, H> where
Assert<{ _ }>: ConstTrue,
impl<const A: usize, const B: usize, const C: usize, H: Tape> Reshape<Tensor0D<H>> for Tensor3D<A, B, C, H> where
Assert<{ _ }>: ConstTrue,
sourceimpl<const A: usize, const B: usize, const C: usize, const D: usize, H: Tape> Reshape<Tensor0D<H>> for Tensor4D<A, B, C, D, H> where
Assert<{ _ }>: ConstTrue,
impl<const A: usize, const B: usize, const C: usize, const D: usize, H: Tape> Reshape<Tensor0D<H>> for Tensor4D<A, B, C, D, 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 M: usize, const N: usize, H: Tape> Reshape<Tensor2D<M, N, H>> for Tensor0D<H> where
Assert<{ _ }>: ConstTrue,
impl<const M: usize, const N: usize, H: Tape> Reshape<Tensor2D<M, N, H>> for Tensor0D<H> where
Assert<{ _ }>: ConstTrue,
sourceimpl<const M: usize, const N: usize, const O: usize, H: Tape> Reshape<Tensor3D<M, N, O, H>> for Tensor0D<H> where
Assert<{ _ }>: ConstTrue,
impl<const M: usize, const N: usize, const O: usize, H: Tape> Reshape<Tensor3D<M, N, O, H>> for Tensor0D<H> where
Assert<{ _ }>: ConstTrue,
sourceimpl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Reshape<Tensor4D<M, N, O, P, H>> for Tensor0D<H> where
Assert<{ _ }>: ConstTrue,
impl<const M: usize, const N: usize, const O: usize, const P: usize, H: Tape> Reshape<Tensor4D<M, N, O, P, H>> for Tensor0D<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<H: Tape> Tensor for Tensor0D<H>
impl<H: Tape> Tensor for Tensor0D<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 TensorCreator for Tensor0D<NoneTape>
impl TensorCreator for Tensor0D<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<Tape> RefUnwindSafe for Tensor0D<Tape> where
Tape: RefUnwindSafe,
impl<Tape = NoneTape> !Send for Tensor0D<Tape>
impl<Tape = NoneTape> !Sync for Tensor0D<Tape>
impl<Tape> Unpin for Tensor0D<Tape> where
Tape: Unpin,
impl<Tape> UnwindSafe for Tensor0D<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.