class
ConvolutionalBlock
[source]
ConvolutionalBlock
(dimensions
:int
,in_channels
:int
,out_channels
:int
,normalization
:str
=None
,kernel_size
:int
=3
,activation
:str
='ReLU'
,preactivation
:bool
=False
,use_padding
:bool
=True
,padding_mode
:str
='zeros'
,dilation
:bool
=None
,dropout
:float
=0
) ::Module
This class defines a convolutional block that can be used for the construction of convolutional neural networks (CNNs).
Type | Default | Details | |
---|---|---|---|
dimensions |
int |
The number of dimensions to consider. Possible options are 2 and 3. | |
in_channels |
int |
The number of input channels. | |
out_channels |
int |
The number of output channels. | |
normalization |
str |
None |
The type of normalization to use. Possible options include "batch", "layer" and "instance". |
kernel_size |
int |
3 |
The size of the convolutional kernel. |
activation |
str |
ReLU |
The activation function that should be used. |
preactivation |
bool |
False |
Whether to use preactivations. |
use_padding |
bool |
True |
Whether to use padding. |
padding_mode |
str |
zeros |
The type of padding to use. |
dilation |
bool |
None |
The amount of dilation that should be used. |
dropout |
float |
0 |
The dropout rate. |
ConvolutionalBlock.forward
[source]
ConvolutionalBlock.forward
(x
:Tensor
)
The forward pass of the convolutional block. Returns a torch.Tensor
.
Type | Default | Details | |
---|---|---|---|
x |
Tensor |
The input to the convolutional block. |