direct.nn.conv package#

Submodules#

direct.nn.conv.conv module#

class direct.nn.conv.conv.Conv2d(in_channels, out_channels, hidden_channels, n_convs=3, activation=nn.PReLU(), batchnorm=False)[source]#

Bases: Module

Implementation of a simple cascade of 2D convolutions.

If batchnorm is set to True, batch normalization layer is applied after each convolution.

__init__(in_channels, out_channels, hidden_channels, n_convs=3, activation=nn.PReLU(), batchnorm=False)[source]#

Inits Conv2d.

Parameters:
  • in_channels (int) – Number of input channels.

  • out_channels (int) – Number of output channels.

  • hidden_channels (int) – Number of hidden channels.

  • n_convs (int) – Number of convolutional layers. Default: 3.

  • activation (Module) – Activation function. Default: nn.PReLU().

  • batchnorm (bool) – If True a batch normalization layer is applied after every convolution. Default: False.

forward(x)[source]#

Performs the forward pass of Conv2d.

Parameters:

x (Tensor) – Input tensor.

Return type:

Tensor

Returns:

Convoluted output.

Module contents#