MCPcopy Create free account
hub / github.com/pytorch/executorch / get_function

Method get_function

examples/models/llama/model_args.py:26–35  ·  view source on GitHub ↗

Return the corresponding activation function.

(self)

Source from the content-addressed store, hash-verified

24 )
25
26 def get_function(self):
27 """Return the corresponding activation function."""
28 if self == ActFn.SILU:
29 return F.silu
30 elif self == ActFn.GELU:
31 return F.gelu
32 elif self == ActFn.GELU_APPROX:
33 return partial(F.gelu, approximate="tanh")
34 else:
35 raise ValueError(f"Unsupported activation function: {self}")
36
37
38@dataclass

Callers 2

__init__Method · 0.80
__init__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected