MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / get_activation

Function get_activation

diffusers/src/diffusers/models/activations.py:36–50  ·  view source on GitHub ↗

Helper function to get activation function from string. Args: act_fn (str): Name of activation function. Returns: nn.Module: Activation function.

(act_fn: str)

Source from the content-addressed store, hash-verified

34
35
36def get_activation(act_fn: str) -> nn.Module:
37 """Helper function to get activation function from string.
38
39 Args:
40 act_fn (str): Name of activation function.
41
42 Returns:
43 nn.Module: Activation function.
44 """
45
46 act_fn = act_fn.lower()
47 if act_fn in ACTIVATION_FUNCTIONS:
48 return ACTIVATION_FUNCTIONS[act_fn]
49 else:
50 raise ValueError(f"Unsupported activation function: {act_fn}")
51
52
53class FP32SiLU(nn.Module):

Callers 15

test_swishMethod · 0.90
test_siluMethod · 0.90
test_mishMethod · 0.90
test_geluMethod · 0.90
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by 4

test_swishMethod · 0.72
test_siluMethod · 0.72
test_mishMethod · 0.72
test_geluMethod · 0.72