direct.nn.resnet package#
Submodules#
direct.nn.resnet.config module#
- class direct.nn.resnet.config.ResNetConfig(model_name: str = '???', engine_name: str | None = None, in_channels: int = 2, out_channels: int | None = None, hidden_channels: int = 32, num_blocks: int = 15, batchnorm: bool = True, scale: float | None = 0.1, image_init: str = 'sense')[source][source]#
Bases:
ModelConfig-
batchnorm:
bool= True#
-
image_init:
str= 'sense'#
-
in_channels:
int= 2#
-
num_blocks:
int= 15#
-
out_channels:
Optional[int] = None#
-
scale:
Optional[float] = 0.1#
-
batchnorm:
direct.nn.resnet.resnet module#
- class direct.nn.resnet.resnet.ResNet(hidden_channels, in_channels=2, out_channels=None, num_blocks=15, batchnorm=True, scale=0.1)[source][source]#
Bases:
ModuleSimple residual network.
Consisted of a sequence of
ResNetBlocksfollowed optionally by batch normalization blocks, followed by an output convolution layer.
- class direct.nn.resnet.resnet.ResNetBlock(in_channels, hidden_channels, scale=0.1)[source][source]#
Bases:
ModuleMain block of
ResNet.Consisted of a convolutional layer followed by a relu activation, a second convolution, and finally a scaled skip connection with the input.
- forward(x)[source][source]#
Define the computation performed at every call.
Should be overridden by all subclasses. :rtype:
TensorNote
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.