pub trait TensorTransform {
    type Broadcast: TensorInstance;
    type Expand: TensorInstance;
    type Reshape: TensorInstance;
    type Slice: TensorInstance;
    type Transpose: TensorInstance;

    // Required methods
    fn broadcast(self, shape: Shape) -> TCResult<Self::Broadcast>;
    fn expand(self, axes: Axes) -> TCResult<Self::Expand>;
    fn reshape(self, shape: Shape) -> TCResult<Self::Reshape>;
    fn slice(self, range: Range) -> TCResult<Self::Slice>;
    fn transpose(self, permutation: Option<Axes>) -> TCResult<Self::Transpose>;
}
Expand description

Tensor transforms

Required Associated Types§

source

type Broadcast: TensorInstance

A broadcast Tensor

source

type Expand: TensorInstance

A Tensor with an expanded dimension

source

type Reshape: TensorInstance

A reshaped Tensor

source

type Slice: TensorInstance

A Tensor slice

source

type Transpose: TensorInstance

A transposed Tensor

Required Methods§

source

fn broadcast(self, shape: Shape) -> TCResult<Self::Broadcast>

Broadcast this Tensor to the given shape.

source

fn expand(self, axes: Axes) -> TCResult<Self::Expand>

Insert a new dimension of size 1 at each of the given axes.

source

fn reshape(self, shape: Shape) -> TCResult<Self::Reshape>

Change the shape of this Tensor.

source

fn slice(self, range: Range) -> TCResult<Self::Slice>

Return a slice of this Tensor with the given range.

source

fn transpose(self, permutation: Option<Axes>) -> TCResult<Self::Transpose>

Transpose this Tensor by reordering its axes according to the given permutation. If no permutation is given, the axes will be reversed.

Implementors§

source§

impl<Txn, FE> TensorTransform for DenseView<Txn, FE>
where Txn: Transaction<FE>, FE: DenseCacheFile + AsType<Node> + Clone,

§

type Broadcast = DenseView<Txn, FE>

§

type Expand = DenseView<Txn, FE>

§

type Reshape = DenseView<Txn, FE>

§

type Slice = DenseView<Txn, FE>

§

type Transpose = DenseView<Txn, FE>

source§

impl<Txn, FE> TensorTransform for Tensor<Txn, FE>
where Txn: Transaction<FE>, FE: DenseCacheFile + AsType<Node> + Clone,

§

type Broadcast = Tensor<Txn, FE>

§

type Expand = Tensor<Txn, FE>

§

type Reshape = Tensor<Txn, FE>

§

type Slice = Tensor<Txn, FE>

§

type Transpose = Tensor<Txn, FE>

source§

impl<Txn, FE> TensorTransform for SparseView<Txn, FE>
where Txn: Transaction<FE>, FE: DenseCacheFile + AsType<Node>,

§

type Broadcast = SparseView<Txn, FE>

§

type Expand = SparseView<Txn, FE>

§

type Reshape = SparseView<Txn, FE>

§

type Slice = SparseView<Txn, FE>

§

type Transpose = SparseView<Txn, FE>

source§

impl<Txn, FE, A> TensorTransform for DenseTensor<Txn, FE, A>
where Txn: ThreadSafe, FE: ThreadSafe, A: DenseInstance,

§

type Broadcast = DenseTensor<Txn, FE, DenseBroadcast<A>>

§

type Expand = DenseTensor<Txn, FE, DenseExpand<A>>

§

type Reshape = DenseTensor<Txn, FE, DenseReshape<A>>

§

type Slice = DenseTensor<Txn, FE, DenseSlice<A>>

§

type Transpose = DenseTensor<Txn, FE, DenseTranspose<A>>

source§

impl<Txn, FE, A> TensorTransform for SparseTensor<Txn, FE, A>
where Txn: Transaction<FE>, FE: AsType<Node> + ThreadSafe, A: SparseInstance + Into<SparseAccess<Txn, FE, A::DType>>, A::DType: CastFrom<Number> + Debug, Number: From<A::DType>,