Miscellaneous Networks#
Classes#
- class MultiNetwork(name, *nets, save_outputs=False, suppress_warning=False, root='', config='', in_shape=None, out_shapes=None, defaults=None)[source]#
Bases:
BaseNetwork[TypedModuleList[CompatibleNetwork|Network]]Network class to hold multiple networks and train them together.
- Attributes:
- name
str Name of the network, used for saving
- version
str NetLoader version string
- checkpoints
list[TensorListLike] Outputs from each checkpoint with each Tensor having shape (N,…) and type float, where N is the batch size
- kl_loss
Tensor KL divergence loss on the latent space of shape (1) and type float, if using a sample layer
- layers
TypedModuleList[CompatibleNetwork|Network] Network construction
- name
- Overloads:
- class MultiNetwork(self, name: str, *nets: torch.nn.modules.module.Module | torch.nn.modules.container.ModuleList | CompatibleNetwork | Network, save_outputs: bool = ...) None
- class MultiNetwork(self, name: str, *nets: str | torch.nn.modules.module.Module | torch.nn.modules.container.ModuleList | CompatibleNetwork | Network | Config, save_outputs: bool = ..., suppress_warning: bool = ..., root: str = ..., config: str = ..., in_shape: list[int] | list[list[int]] | tuple[int, ...] | None = ..., out_shapes: list[list[int]] | None = ..., defaults: list[dict[str, Any]] | dict[str, Any] | None = ...) None
- Parameters:
- name
str Name of the network, used for saving
- *nets: str | nn.Module | nn.ModuleList | CompatibleNetwork | Network | Config
Networks to combine sequentially
- save_outputsbool,
Optional If outputs from each network should be saved, default = False
- suppress_warningbool,
Optional If output shape mismatch warning should be suppressed, default = False
- root
str,Optional Root directory to prepend to config file path if any network is a string or Config
- config
str,Optional Path to the network config directory if any network is a string
- in_shape
list[int] |list[list[int]] |tuple[int, …],Optional Input shape for the first network in the MultiNetwork if any network is a string or Config
- out_shapes
list[list[int]],Optional Output shapes for each network in the MultiNetwork if any network is a string or Config
- defaults
list[dict[str,Any]] |dict[str,Any] |NoneType,Optional Default values for the parameters for each type of layer for all or each network
- name
- forward(x)[source]#
Forward pass through all networks in the MultiNetwork.
- Parameters:
- x
TensorListLike Input tensor(s) with shape (N,…) and type float, where N is the batch size
- x
- Returns:
TensorListLikeOutput tensor from the network with shape (N,…) and type float
- get_config(dict_=True)[source]#
Returns the network configuration.
- Overloads:
- get_config(self, dict_: Literal[False] = ...) Config
- to(*args, **kwargs)[source]#
See
torch.nn.Module.to().