pub trait ModuleOps<B: Backend> {
Show 25 methods // Required methods fn conv2d( x: B::TensorPrimitive<4>, weight: B::TensorPrimitive<4>, bias: Option<B::TensorPrimitive<1>>, options: ConvOptions<2> ) -> B::TensorPrimitive<4>; fn conv_transpose2d( x: B::TensorPrimitive<4>, weight: B::TensorPrimitive<4>, bias: Option<B::TensorPrimitive<1>>, options: ConvTransposeOptions<2> ) -> B::TensorPrimitive<4>; fn avg_pool2d( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], count_include_pad: bool ) -> B::TensorPrimitive<4>; fn avg_pool2d_backward( x: B::TensorPrimitive<4>, grad: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], count_include_pad: bool ) -> B::TensorPrimitive<4>; fn adaptive_avg_pool2d( x: B::TensorPrimitive<4>, output_size: [usize; 2] ) -> B::TensorPrimitive<4>; fn adaptive_avg_pool2d_backward( x: B::TensorPrimitive<4>, grad: B::TensorPrimitive<4> ) -> B::TensorPrimitive<4>; fn max_pool2d( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], dilation: [usize; 2] ) -> B::TensorPrimitive<4>; fn max_pool2d_with_indices( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], dilation: [usize; 2] ) -> MaxPool2dWithIndices<B>; fn max_pool2d_with_indices_backward( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], dilation: [usize; 2], output_grad: B::TensorPrimitive<4>, indices: B::IntTensorPrimitive<4> ) -> MaxPool2dBackward<B>; // Provided methods fn embedding( weights: B::TensorPrimitive<2>, indices: B::IntTensorPrimitive<2> ) -> B::TensorPrimitive<3> { ... } fn embedding_backward( weights: B::TensorPrimitive<2>, output_grad: B::TensorPrimitive<3>, indices: B::IntTensorPrimitive<2> ) -> B::TensorPrimitive<2> { ... } fn conv1d( x: B::TensorPrimitive<3>, weight: B::TensorPrimitive<3>, bias: Option<B::TensorPrimitive<1>>, options: ConvOptions<1> ) -> B::TensorPrimitive<3> { ... } fn conv1d_backward( x: B::TensorPrimitive<3>, weight: B::TensorPrimitive<3>, bias: Option<B::TensorPrimitive<1>>, output_grad: B::TensorPrimitive<3>, options: ConvOptions<1> ) -> Conv1dBackward<B> { ... } fn conv2d_backward( x: B::TensorPrimitive<4>, weight: B::TensorPrimitive<4>, bias: Option<B::TensorPrimitive<1>>, output_grad: B::TensorPrimitive<4>, options: ConvOptions<2> ) -> Conv2dBackward<B> { ... } fn conv_transpose1d( x: B::TensorPrimitive<3>, weight: B::TensorPrimitive<3>, bias: Option<B::TensorPrimitive<1>>, options: ConvTransposeOptions<1> ) -> B::TensorPrimitive<3> { ... } fn conv_transpose1d_backward( x: B::TensorPrimitive<3>, weight: B::TensorPrimitive<3>, bias: Option<B::TensorPrimitive<1>>, output_grad: B::TensorPrimitive<3>, options: ConvTransposeOptions<1> ) -> Conv1dBackward<B> { ... } fn conv_transpose2d_backward( x: B::TensorPrimitive<4>, weight: B::TensorPrimitive<4>, bias: Option<B::TensorPrimitive<1>>, output_grad: B::TensorPrimitive<4>, options: ConvTransposeOptions<2> ) -> Conv2dBackward<B> { ... } fn unfold4d( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], options: UnfoldOptions ) -> B::TensorPrimitive<3> { ... } fn avg_pool1d( x: B::TensorPrimitive<3>, kernel_size: usize, stride: usize, padding: usize, count_include_pad: bool ) -> B::TensorPrimitive<3> { ... } fn avg_pool1d_backward( x: B::TensorPrimitive<3>, grad: B::TensorPrimitive<3>, kernel_size: usize, stride: usize, padding: usize, count_include_pad: bool ) -> B::TensorPrimitive<3> { ... } fn adaptive_avg_pool1d( x: B::TensorPrimitive<3>, output_size: usize ) -> B::TensorPrimitive<3> { ... } fn adaptive_avg_pool1d_backward( x: B::TensorPrimitive<3>, grad: B::TensorPrimitive<3> ) -> B::TensorPrimitive<3> { ... } fn max_pool1d( x: B::TensorPrimitive<3>, kernel_size: usize, stride: usize, padding: usize, dilation: usize ) -> B::TensorPrimitive<3> { ... } fn max_pool1d_with_indices( x: B::TensorPrimitive<3>, kernel_size: usize, stride: usize, padding: usize, dilation: usize ) -> MaxPool1dWithIndices<B> { ... } fn max_pool1d_with_indices_backward( x: B::TensorPrimitive<3>, kernel_size: usize, stride: usize, padding: usize, dilation: usize, output_grad: B::TensorPrimitive<3>, indices: B::IntTensorPrimitive<3> ) -> MaxPool1dBackward<B> { ... }
}
Expand description

Module operations trait.

Required Methods§

source

fn conv2d( x: B::TensorPrimitive<4>, weight: B::TensorPrimitive<4>, bias: Option<B::TensorPrimitive<1>>, options: ConvOptions<2> ) -> B::TensorPrimitive<4>

Two dimensional convolution.

Shapes

x: [batch_size, channels_in, height, width], weight: [channels_out, channels_in, kernel_size_1, kernel_size_2], bias: [channels_out],

source

fn conv_transpose2d( x: B::TensorPrimitive<4>, weight: B::TensorPrimitive<4>, bias: Option<B::TensorPrimitive<1>>, options: ConvTransposeOptions<2> ) -> B::TensorPrimitive<4>

Two dimensional transposed convolution.

Shapes

x: [batch_size, channels_in, height, width], weight: [channels_in, channels_out, kernel_size_1, kernel_size_2], bias: [channels_out],

source

fn avg_pool2d( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], count_include_pad: bool ) -> B::TensorPrimitive<4>

Two dimensional avg pooling.

Shapes

x: [batch_size, channels, height, width],

source

fn avg_pool2d_backward( x: B::TensorPrimitive<4>, grad: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], count_include_pad: bool ) -> B::TensorPrimitive<4>

Backward pass for the avg pooling 2d operation.

source

fn adaptive_avg_pool2d( x: B::TensorPrimitive<4>, output_size: [usize; 2] ) -> B::TensorPrimitive<4>

Two dimensional adaptive avg pooling.

Shapes

x: [batch_size, channels, height, width],

source

fn adaptive_avg_pool2d_backward( x: B::TensorPrimitive<4>, grad: B::TensorPrimitive<4> ) -> B::TensorPrimitive<4>

Backward pass for the adaptive avg pooling 2d operation.

source

fn max_pool2d( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], dilation: [usize; 2] ) -> B::TensorPrimitive<4>

Two dimensional max pooling.

Shapes

x: [batch_size, channels, height, width],

source

fn max_pool2d_with_indices( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], dilation: [usize; 2] ) -> MaxPool2dWithIndices<B>

Two dimensional max pooling with indices.

Shapes

x: [batch_size, channels, height, width],

source

fn max_pool2d_with_indices_backward( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], dilation: [usize; 2], output_grad: B::TensorPrimitive<4>, indices: B::IntTensorPrimitive<4> ) -> MaxPool2dBackward<B>

Backward pass for the max pooling 2d operation.

Provided Methods§

source

fn embedding( weights: B::TensorPrimitive<2>, indices: B::IntTensorPrimitive<2> ) -> B::TensorPrimitive<3>

Embedding operation.

Arguments
  • weights - The embedding weights.
  • indices - The indices tensor.
Returns

The output tensor.

source

fn embedding_backward( weights: B::TensorPrimitive<2>, output_grad: B::TensorPrimitive<3>, indices: B::IntTensorPrimitive<2> ) -> B::TensorPrimitive<2>

Embedding backward operation.

Arguments
  • weights - The embedding weights.
  • output_grad - The output gradient.
  • indices - The indices tensor.
Returns

The gradient.

source

fn conv1d( x: B::TensorPrimitive<3>, weight: B::TensorPrimitive<3>, bias: Option<B::TensorPrimitive<1>>, options: ConvOptions<1> ) -> B::TensorPrimitive<3>

One dimensional convolution.

Shapes

x: [batch_size, channels_in, length], weight: [channels_out, channels_in, kernel_size], bias: [channels_out],

source

fn conv1d_backward( x: B::TensorPrimitive<3>, weight: B::TensorPrimitive<3>, bias: Option<B::TensorPrimitive<1>>, output_grad: B::TensorPrimitive<3>, options: ConvOptions<1> ) -> Conv1dBackward<B>

Backward pass for the conv1d operation.

source

fn conv2d_backward( x: B::TensorPrimitive<4>, weight: B::TensorPrimitive<4>, bias: Option<B::TensorPrimitive<1>>, output_grad: B::TensorPrimitive<4>, options: ConvOptions<2> ) -> Conv2dBackward<B>

Backward pass for the conv2d operation.

source

fn conv_transpose1d( x: B::TensorPrimitive<3>, weight: B::TensorPrimitive<3>, bias: Option<B::TensorPrimitive<1>>, options: ConvTransposeOptions<1> ) -> B::TensorPrimitive<3>

One dimensional transposed convolution.

Shapes

x: [batch_size, channels_in, length], weight: [channels_in, channels_out, length], bias: [channels_out],

source

fn conv_transpose1d_backward( x: B::TensorPrimitive<3>, weight: B::TensorPrimitive<3>, bias: Option<B::TensorPrimitive<1>>, output_grad: B::TensorPrimitive<3>, options: ConvTransposeOptions<1> ) -> Conv1dBackward<B>

Backward pass for the conv transpose 1d operation.

source

fn conv_transpose2d_backward( x: B::TensorPrimitive<4>, weight: B::TensorPrimitive<4>, bias: Option<B::TensorPrimitive<1>>, output_grad: B::TensorPrimitive<4>, options: ConvTransposeOptions<2> ) -> Conv2dBackward<B>

Backward pass for the conv transpose 2d operation.

source

fn unfold4d( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], options: UnfoldOptions ) -> B::TensorPrimitive<3>

Four-dimensional unfolding.

Shapes

x: [batch_size, channels_in, height, width], returns: [batch_size, channels_in * kernel_size_1 * kernel_size_2, number of blocks],

source

fn avg_pool1d( x: B::TensorPrimitive<3>, kernel_size: usize, stride: usize, padding: usize, count_include_pad: bool ) -> B::TensorPrimitive<3>

One dimensional avg pooling.

Shapes

x: [batch_size, channels, length],

source

fn avg_pool1d_backward( x: B::TensorPrimitive<3>, grad: B::TensorPrimitive<3>, kernel_size: usize, stride: usize, padding: usize, count_include_pad: bool ) -> B::TensorPrimitive<3>

Backward pass for the avg pooling 1d operation.

source

fn adaptive_avg_pool1d( x: B::TensorPrimitive<3>, output_size: usize ) -> B::TensorPrimitive<3>

One dimensional adaptive avg pooling.

Shapes

x: [batch_size, channels, length],

source

fn adaptive_avg_pool1d_backward( x: B::TensorPrimitive<3>, grad: B::TensorPrimitive<3> ) -> B::TensorPrimitive<3>

Backward pass for the adaptive avg pooling 1d operation.

source

fn max_pool1d( x: B::TensorPrimitive<3>, kernel_size: usize, stride: usize, padding: usize, dilation: usize ) -> B::TensorPrimitive<3>

One dimensional max pooling.

Shapes

x: [batch_size, channels, length],

source

fn max_pool1d_with_indices( x: B::TensorPrimitive<3>, kernel_size: usize, stride: usize, padding: usize, dilation: usize ) -> MaxPool1dWithIndices<B>

One dimensional max pooling with indices.

Shapes

x: [batch_size, channels, height, width],

source

fn max_pool1d_with_indices_backward( x: B::TensorPrimitive<3>, kernel_size: usize, stride: usize, padding: usize, dilation: usize, output_grad: B::TensorPrimitive<3>, indices: B::IntTensorPrimitive<3> ) -> MaxPool1dBackward<B>

Backward pass for the max pooling 1d operation.

Object Safety§

This trait is not object safe.

Implementors§