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

A 2d super::Tensor with shape (M, N). Backed by data [[f32; 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 clamp() on self

Calls dropout() on self.

Calls value_mask() on self

Calls max()

Calls maximum() on self.

Calls mean() with AllAxes

Calls min()

Calls minimum() on self.

Calls nans_to() on self.

Calls powf() on self.

Calls powi() on self.

Calls logsumexp() on self with Axes.

Calls log_softmax() on self with Axes

Calls softmax() on self with Axes

Calls stddev()

Calls var()

Calls sum().

Calls negate() on self.

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.

Trait Implementations

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

The resulting type after applying the + operator.

Calls add() - implements T<L> + T<R>

The resulting type after applying the + operator.

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

The resulting type after applying the + operator.
Broadcast self into T. This can be used to broadcast 1, 2, 3, and 4 axes. Read more
Broadcast self into T. This can be used to broadcast 1, 2, 3, and 4 axes. Read more
Broadcast self into T. This can be used to broadcast 1, 2, 3, and 4 axes. Read more
Broadcast self into T. This can be used to broadcast 1, 2, 3, and 4 axes. Read more
Broadcast self into T. This can be used to broadcast 1, 2, 3, and 4 axes. Read more
Broadcast self into T. This can be used to broadcast 1, 2, 3, and 4 axes. Read more
Broadcast self into T. This can be used to broadcast 1, 2, 3, and 4 axes. Read more
Broadcast self into T. This can be used to broadcast 1, 2, 3, and 4 axes. Read more
Broadcast self into T. This can be used to broadcast 1, 2, 3, and 4 axes. Read more
Broadcast self into T. This can be used to broadcast 1, 2, 3, and 4 axes. Read more
Broadcast self into T. This can be used to broadcast 1, 2, 3, and 4 axes. Read more
Broadcast self into T. This can be used to broadcast 1, 2, 3, and 4 axes. Read more

Clones the underlying id, data, and tape

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<L> / T<R>

The resulting type after applying the / operator.

Calls div_scalar() - 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.

Batched 2d forward using matmul() and add()

The type that this unit produces given Input.
The type that this unit produces given Input.
The type that this unit produces given Input.
Forward Input through the module and produce Module::Output. Read more
The type that this unit produces given Input.
Forward Input through the module and produce Module::Output. Read more
The type that this unit produces given Input.
Forward Input through the module and produce Module::Output. Read more

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

The resulting type after applying the * operator.

Calls mul() - implements T<L> * T<R>

The resulting type after applying the * operator.

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

The resulting type after applying the * operator.

Calls negate() on self.

The resulting type after applying the - operator.
Permutes the tensor Read more
Permutes the tensor Read more
Replaces whatever tape is in self with tape.

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

The resulting tensor type. This can be broadcast into Self via BroadcastTo. Read more
The resulting tensor type. This can be broadcast into Self via BroadcastTo. Read more
The resulting tensor type. This can be broadcast into Self via BroadcastTo. Read more
Reshape self into T.
Reshape self into T.
Reshape self into T.
Reshape self into T.
Reshape self into T.
Reshape self into T.
Reshape self into T.
Reshape self into T.
Reshape self into T.
Select sub elements using Self::Indices. The same element can be selected multiple times depending on Self::Indices. Read more
Select sub elements using Self::Indices. The same element can be selected multiple times depending on Self::Indices. Read more
Select sub elements using Self::Indices. The same element can be selected multiple times depending on Self::Indices. Read more
Select sub elements using Self::Indices. The same element can be selected multiple times depending on Self::Indices. Read more
Select sub elements using Self::Indices. The same element can be selected multiple times depending on Self::Indices. Read more
Select sub elements using Self::Indices. The same element can be selected multiple times depending on Self::Indices. Read more
Select sub elements using Self::Indices. The same element can be selected multiple times depending on Self::Indices. Read more
Select sub elements using Self::Indices. The same element can be selected multiple times depending on Self::Indices. Read more
Select sub elements using Self::Indices. The same element can be selected multiple times depending on Self::Indices. Read more

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

The resulting type after applying the - operator.

Calls sub() - implements T<L> - T<R>

The resulting type after applying the - operator.

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

The resulting type after applying the - operator.
The Tape this tensor owns.
This tensor but with NoneTape.
Removes whatever Tape this tensor has and returns itself without a tape.
Clones self and initializes a new empty tape.

Returns a new object with data and a new id.

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.

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

Subtracts the gradient for the tensor from HasArrayData::mut_data.

Returns the argument unchanged.

Calls U::from(self).

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

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.