Trait tc_tensor::TensorTransform
source · pub trait TensorTransform {
type Broadcast: TensorInstance;
type Cast: TensorInstance;
type Expand: TensorInstance;
type Flip: TensorInstance;
type Reshape: TensorInstance;
type Slice: TensorInstance;
type Transpose: TensorInstance;
fn broadcast(self, shape: Shape) -> TCResult<Self::Broadcast>;
fn cast_into(self, dtype: NumberType) -> TCResult<Self::Cast>;
fn expand_dims(self, axis: usize) -> TCResult<Self::Expand>;
fn flip(self, axis: usize) -> TCResult<Self::Flip>;
fn reshape(self, shape: Shape) -> TCResult<Self::Reshape>;
fn slice(self, bounds: Bounds) -> TCResult<Self::Slice>;
fn transpose(
self,
permutation: Option<Vec<usize>>
) -> TCResult<Self::Transpose>;
}
Expand description
Tensor
transforms
Required Associated Types§
sourcetype Broadcast: TensorInstance
type Broadcast: TensorInstance
A broadcast Tensor
sourcetype Cast: TensorInstance
type Cast: TensorInstance
A type-cast Tensor
sourcetype Expand: TensorInstance
type Expand: TensorInstance
A Tensor
with an expanded dimension
sourcetype Flip: TensorInstance
type Flip: TensorInstance
A Tensor
flipped around one axis
sourcetype Reshape: TensorInstance
type Reshape: TensorInstance
A reshaped Tensor
sourcetype Slice: TensorInstance
type Slice: TensorInstance
A Tensor
slice
sourcetype Transpose: TensorInstance
type Transpose: TensorInstance
A transposed Tensor
Required Methods§
sourcefn broadcast(self, shape: Shape) -> TCResult<Self::Broadcast>
fn broadcast(self, shape: Shape) -> TCResult<Self::Broadcast>
Broadcast this Tensor
to the given shape
.
sourcefn cast_into(self, dtype: NumberType) -> TCResult<Self::Cast>
fn cast_into(self, dtype: NumberType) -> TCResult<Self::Cast>
Cast this Tensor
to the given dtype
.
sourcefn expand_dims(self, axis: usize) -> TCResult<Self::Expand>
fn expand_dims(self, axis: usize) -> TCResult<Self::Expand>
Insert a new dimension of size 1 at the given axis
.