pub trait Tensor: HasArrayType + HasArrayData + HasDevice + CanUpdateWithGradients + HasUniqueId + IntoPhantom {
type Tape: Tape;
type NoTape: 'static + Tensor<Array = Self::Array, Dtype = Self::Dtype, Tape = NoneTape, NoTape = Self::NoTape> + TensorCreator + PutTape<Self::Tape, Output = Self> + Clone;
type OwnedTape: 'static + Tensor<Array = Self::Array, Dtype = Self::Dtype, Tape = OwnedTape, OwnedTape = Self::OwnedTape>;
type LastDimReduced: Tensor<Tape = Self::Tape, Dtype = Self::Dtype, Array = <Self::Device as ReduceLastDim<Self::Array>>::Reduced>;
type ReducingIndices: CountElements<Dtype = usize>;
fn split_tape(self) -> (Self::NoTape, Self::Tape);
fn duplicate(&self) -> Self::NoTape;
}
Expand description
The main tensor trait. A tensor consists of mainly 1. an array, 2. a device, 3. a unique id.
Required Associated Types
This tensor but with NoneTape.
This tensor but with OwnedTape
type LastDimReduced: Tensor<Tape = Self::Tape, Dtype = Self::Dtype, Array = <Self::Device as ReduceLastDim<Self::Array>>::Reduced>
type LastDimReduced: Tensor<Tape = Self::Tape, Dtype = Self::Dtype, Array = <Self::Device as ReduceLastDim<Self::Array>>::Reduced>
This tensor but with it’s last dimension reduced to 1. See ReduceLastDim.
type ReducingIndices: CountElements<Dtype = usize>
type ReducingIndices: CountElements<Dtype = usize>
Indices used for gather_last_dim() that can reduce this tensor to it’s Tensor::LastDimReduced.
Required Methods
fn 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.