pub struct Tensor4D<const M: usize, const N: usize, const O: usize, const P: usize, Tape = NoneTape> { /* private fields */ }
Expand description

A 4d super::Tensor with shape (M, N, O, P). Backed by data [[[[f32; P]; O]; N]; M].

Implementations

Clones self and returns a copy with OwnedTape as the crate::gradients::Tape.

See traced for a version that takes ownership of the tensor.

Takes ownership of self and inserts OwnedTape as the crate::gradients::Tape.

Calls relu() on self.

Calls sin() on self.

Calls cos() on self.

Calls ln() on self.

Calls exp() on self.

Calls sigmoid() on self.

Calls tanh() on self.

Calls square() on self.

Calls sqrt() on self.

Calls abs() on self.

Calls backward() on self

Calls clamp() on self

Calls dropout() on self.

Calls gather_last_dim() on self.

Calls value_mask() on self

Calls max_last_dim() on self.

Calls mean() on self.

Calls mean_last_dim() on self.

Calls nans_to() on self.

Calls normalize() on self.

Calls logsumexp() on self.

Calls log_softmax() on self

Calls softmax() on self

Calls std_last_dim() on self.

Calls var_last_dim() on self.

Calls sum() on self.

Calls sum_last_dim() on self.

Trait Implementations

Calls add() - implements T<H> + &T<NoneTape>

The resulting type after applying the + operator.

Calls scalar_add() - implements f32 + T<H>

The resulting type after applying the + operator.

Calls scalar_add() - implements T<H> + f32

The resulting type after applying the + operator.

Clones the underlying data and tape. Creates a new UniqueId.

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns a tensor with all elements equal to 0

Calls div() - implements T<H> / &T<NoneTape>

The resulting type after applying the / operator.

Calls scalar_div() - implements T<H> / f32

The resulting type after applying the / operator.

Returns a reference to the underlying array.

Returns a mutable reference to the underlying array.

Calls mul() - implements T<H> * &T<NoneTape>

The resulting type after applying the * operator.

Calls scalar_mul() - implements f32 * T<H>

The resulting type after applying the * operator.

Calls scalar_mul() - implements T<H> * f32

The resulting type after applying the * operator.

Calls negate() on self.

The resulting type after applying the - operator.

Fills self.mut_data() with data from the distribution D

Calls sub() - implements T<H> - &T<NoneTape>

The resulting type after applying the - operator.

Calls scalar_add() with neg(rhs) - implements -T<H> + f32

The resulting type after applying the - operator.

Calls scalar_sub() - implements T<H> - f32

The resulting type after applying the - operator.

The Tape this tensor owns.

This tensor but with NoneTape.

This tensor but with OwnedTape

This tensor but with it’s last dimension reduced to 1. See ReduceLastDim.

Indices used for gather_last_dim() that can reduce this tensor to it’s Tensor::LastDimReduced.

Removes whatever Tape this tensor has and returns itself without a tape.

Clones the data & UniqueId of this tensor and returns something with NoneTape.

Returns a new object with data and a new UniqueId.

Create a new tensor with Self::Array on the stack. This just boxes Self::Array and calls TensorCreator::new_boxed.

Creates a tensor filled with all 0s.

Creates a tensor filled with all 1s.

Creates a tensor filled with values sampled from Standard distribution.

Creates a tensor filled with values sampled from StandardNormal distribution.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.