MCPcopy Index your code
hub / github.com/huggingface/diffusers / get_activation

Function get_activation

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 ACT2CLS:
48 return ACT2CLS[act_fn]()
49 else:
50 raise ValueError(f"activation function {act_fn} not found in ACT2FN mapping {list(ACT2CLS.keys())}")
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.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

Calls

no outgoing calls

Tested by 4

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…