nn.many_to_many_rnn.get_activation

nn.many_to_many_rnn.get_activation(name)

Return the activation module for a spotPython act_fn level name.

Parameters

Name Type Description Default
name str Activation name. Options: - “Sigmoid” - “Tanh” - “ReLU” - “LeakyReLU”: negative slope 0.1, matching spotPython. - “ELU” - “Swish”: implemented as nn.SiLU. required

Returns

Name Type Description
nn.Module nn.Module: A fresh activation module instance.

Raises

Name Type Description
ValueError If name is not a supported activation name.

Examples

from spotoptim.nn.many_to_many_rnn import get_activation

act = get_activation("LeakyReLU")
print(type(act).__name__, act.negative_slope)
LeakyReLU 0.1