Helper function to get activation function from string. Args: act_fn (str): Name of activation function. Returns: nn.Module: Activation function.
(act_fn: str)
| 84 | |
| 85 | |
| 86 | def get_activation(act_fn: str) -> nn.Module: |
| 87 | """Helper function to get activation function from string. |
| 88 | |
| 89 | Args: |
| 90 | act_fn (str): Name of activation function. |
| 91 | |
| 92 | Returns: |
| 93 | nn.Module: Activation function. |
| 94 | """ |
| 95 | |
| 96 | act_fn = act_fn.lower() |
| 97 | if act_fn in ACTIVATION_FUNCTIONS: |
| 98 | return ACTIVATION_FUNCTIONS[act_fn] |
| 99 | else: |
| 100 | raise ValueError(f"Unsupported activation function: {act_fn}") |
| 101 | |
| 102 | |
| 103 | def get_timestep_embedding( |