paraphernalia.torch.modules module¶
A collection of utility PyTorch modules.
- class AdaptiveMultiLoss(num_losses)[source]¶
Automatic loss balancing.
See also
- Parameters
components ([type]) – [description]
num_losses (int) –
- class Parallel(components)[source]¶
A module that runs a number of submodule in parallel and collects their outputs into a list.
- Parameters
components (List[nn.Module]) – a list of submdodules to run in parallel
- class Constant(value)[source]¶
A module that returns a constant value, ignoring any inputs.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- Parameters
value (torch.Tensor) –
- class WeightedSum(**components)[source]¶
More or less a weighted sum of named module outputs, but with special handling for negative weights.
In order for the weighting to make sense, the components needs outputs with the same shape and meaning.
For loss functions outputs should be in the range [0,1]
- Parameters
components (torch.nn.modules.module.Module) –