models.generator.ModelGen#
- class ModelGen(cfg: BaseConfig, in_channels: int = 2, init_weights: bool = True)[source]#
Bases:
Module
Base class for model generators
Class
BlockGen
is used as a generation tool.Child classes must define ways to process input and output data. Different variants are presented in classes
models.backbone.BackboneGen
,models.neck.NeckGen
,models.head.HeadGen
.Warning
This class can only be used as a base class for inheritance.
- Parameters:
cfg (BaseConfig) – Network Configuration Generator.
in_channels (int, optional) – Number of input channels. Defaults to 2.
init_weights (bool, optional) – If
true
apply weight initialization function. Defaults to True.
Methods
Network pass for data containing time resolution
State-based network pass
Attributes
List of configurations provided by default.
The number of channels that will be after applying this block to a tensor with
in_channels
channels.training
- forward(X: Tensor)[source]#
Network pass for data containing time resolution
- Parameters:
X (torch.Tensor) – Input tensor. Shape is Shape [ts, batch, channel, h, w].
- Returns:
The resulting tensor and the list of new states.
- Return type:
- forward_impl(X: Tensor, state: ListState | None = None)[source]#
State-based network pass
- Parameters:
X (torch.Tensor) – Input tensor. Shape is Shape [batch, channel, h, w].
state (ListState | None, optional) – List of block layer states. Defaults to None.
- Returns:
The resulting tensor and the list of new states.
- Return type:
Tuple[torch.Tensor, ListState]