torch_enums
- class ActivationFunction(value)[source]
Bases:
enum.Enum
An enumeration.
- NONE = 'none'
- SIGMOID = 'sigmoid'
- RELU = 'relu'
- TANH = 'tanh'
- LOG_SOFTMAX = 'log_softmax'
- SOFTMAX = 'softmax'
- classmethod from_name(name: str) sensai.torch.torch_enums.ActivationFunction
- get_torch_function() Optional[Callable]
- get_name() str
- classmethod torch_function_from_any(f: Optional[Union[str, sensai.torch.torch_enums.ActivationFunction, Callable]]) Optional[Callable]
Gets the torch activation for the given argument
- Parameters
f – either an instance of ActivationFunction, the name of a function from torch.nn.functional or an actual function
- Returns
a function that can be applied to tensors (or None)
- class ClassificationOutputMode(value)[source]
Bases:
enum.Enum
An enumeration.
- PROBABILITIES = 'probabilities'
- LOG_PROBABILITIES = 'log_probabilities'
- UNNORMALISED_LOG_PROBABILITIES = 'unnormalised_log_probabilities'
- classmethod for_activation_fn(fn: Optional[Union[Callable, sensai.torch.torch_enums.ActivationFunction]])