MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / _get_activation_fn

Function _get_activation_fn

models/aios/utils.py:169–181  ·  view source on GitHub ↗

Return an activation function given a string.

(activation, d_model=256, batch_dim=0)

Source from the content-addressed store, hash-verified

167
168
169def _get_activation_fn(activation, d_model=256, batch_dim=0):
170 """Return an activation function given a string."""
171 if activation == 'relu':
172 return F.relu
173 if activation == 'gelu':
174 return F.gelu
175 if activation == 'glu':
176 return F.glu
177 if activation == 'prelu':
178 return nn.PReLU()
179 if activation == 'selu':
180 return F.selu
181 raise RuntimeError(F'activation should be relu/gelu, not {activation}.')
182
183
184def gen_sineembed_for_position(pos_tensor):

Callers 2

__init__Method · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected