Trait burn_tensor::ops::ModuleOps
source · pub trait ModuleOps<B: Backend> {
Show 13 methods
// Required methods
fn embedding(
weights: B::TensorPrimitive<2>,
indexes: B::IntTensorPrimitive<2>
) -> B::TensorPrimitive<3>;
fn embedding_backward(
weights: B::TensorPrimitive<2>,
output: B::TensorPrimitive<3>,
indexes: B::IntTensorPrimitive<2>
) -> B::TensorPrimitive<2>;
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]
) -> 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]
) -> B::TensorPrimitive<4>;
fn max_pool2d(
x: B::TensorPrimitive<4>,
kernel_size: [usize; 2],
stride: [usize; 2],
padding: [usize; 2]
) -> B::TensorPrimitive<4>;
fn max_pool2d_with_indexes(
x: B::TensorPrimitive<4>,
kernel_size: [usize; 2],
stride: [usize; 2],
padding: [usize; 2]
) -> MaxPool2dWithIndexes<B>;
fn max_pool2d_with_indexes_backward(
x: B::TensorPrimitive<4>,
kernel_size: [usize; 2],
stride: [usize; 2],
padding: [usize; 2],
output_grad: B::TensorPrimitive<4>,
indexes: B::IntTensorPrimitive<4>
) -> MaxPool2dBackward<B>;
// Provided methods
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 conv1d(
x: B::TensorPrimitive<3>,
weight: B::TensorPrimitive<3>,
bias: Option<B::TensorPrimitive<1>>,
options: ConvOptions<1>
) -> B::TensorPrimitive<3> { ... }
fn conv_transpose1d(
x: B::TensorPrimitive<3>,
weight: B::TensorPrimitive<3>,
bias: Option<B::TensorPrimitive<1>>,
options: ConvTransposeOptions<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> { ... }
}
Required Methods§
fn embedding( weights: B::TensorPrimitive<2>, indexes: B::IntTensorPrimitive<2> ) -> B::TensorPrimitive<3>
fn embedding_backward( weights: B::TensorPrimitive<2>, output: B::TensorPrimitive<3>, indexes: B::IntTensorPrimitive<2> ) -> B::TensorPrimitive<2>
sourcefn conv2d(
x: B::TensorPrimitive<4>,
weight: B::TensorPrimitive<4>,
bias: Option<B::TensorPrimitive<1>>,
options: ConvOptions<2>
) -> B::TensorPrimitive<4>
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],
sourcefn conv_transpose2d(
x: B::TensorPrimitive<4>,
weight: B::TensorPrimitive<4>,
bias: Option<B::TensorPrimitive<1>>,
options: ConvTransposeOptions<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>
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],
sourcefn avg_pool2d(
x: B::TensorPrimitive<4>,
kernel_size: [usize; 2],
stride: [usize; 2],
padding: [usize; 2]
) -> B::TensorPrimitive<4>
fn avg_pool2d( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2] ) -> B::TensorPrimitive<4>
sourcefn avg_pool2d_backward(
x: B::TensorPrimitive<4>,
grad: B::TensorPrimitive<4>,
kernel_size: [usize; 2],
stride: [usize; 2],
padding: [usize; 2]
) -> 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] ) -> B::TensorPrimitive<4>
Backward pass for the avg pooling 2d operation.
sourcefn max_pool2d(
x: B::TensorPrimitive<4>,
kernel_size: [usize; 2],
stride: [usize; 2],
padding: [usize; 2]
) -> B::TensorPrimitive<4>
fn max_pool2d( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2] ) -> B::TensorPrimitive<4>
sourcefn max_pool2d_with_indexes(
x: B::TensorPrimitive<4>,
kernel_size: [usize; 2],
stride: [usize; 2],
padding: [usize; 2]
) -> MaxPool2dWithIndexes<B>
fn max_pool2d_with_indexes( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2] ) -> MaxPool2dWithIndexes<B>
sourcefn max_pool2d_with_indexes_backward(
x: B::TensorPrimitive<4>,
kernel_size: [usize; 2],
stride: [usize; 2],
padding: [usize; 2],
output_grad: B::TensorPrimitive<4>,
indexes: B::IntTensorPrimitive<4>
) -> MaxPool2dBackward<B>
fn max_pool2d_with_indexes_backward( x: B::TensorPrimitive<4>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], output_grad: B::TensorPrimitive<4>, indexes: B::IntTensorPrimitive<4> ) -> MaxPool2dBackward<B>
Backward pass for the max pooling 2d operation.
Provided Methods§
sourcefn 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 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.
sourcefn conv1d(
x: B::TensorPrimitive<3>,
weight: B::TensorPrimitive<3>,
bias: Option<B::TensorPrimitive<1>>,
options: ConvOptions<1>
) -> B::TensorPrimitive<3>
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],
sourcefn conv_transpose1d(
x: B::TensorPrimitive<3>,
weight: B::TensorPrimitive<3>,
bias: Option<B::TensorPrimitive<1>>,
options: ConvTransposeOptions<1>
) -> B::TensorPrimitive<3>
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],
sourcefn 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 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.