torch_enums#


class ActivationFunction(value)[source]#

Bases: Enum

An enumeration.

NONE = 'none'#
SIGMOID = 'sigmoid'#
RELU = 'relu'#
TANH = 'tanh'#
LOG_SOFTMAX = 'log_softmax'#
SOFTMAX = 'softmax'#
classmethod from_name(name: str) ActivationFunction[source]#
get_torch_function() Optional[Callable][source]#
get_name() str[source]#
classmethod torch_function_from_any(f: Optional[Union[str, ActivationFunction, Callable]]) Optional[Callable][source]#

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

An enumeration.

PROBABILITIES = 'probabilities'#
LOG_PROBABILITIES = 'log_probabilities'#
UNNORMALISED_LOG_PROBABILITIES = 'unnormalised_log_probabilities'#
classmethod for_activation_fn(fn: Optional[Union[Callable, ActivationFunction]])[source]#