MCPcopy Create free account
hub / github.com/NineAbyss/ZeroG / obtain_act

Function obtain_act

code/utils.py:183–202  ·  view source on GitHub ↗

Return activation function module

(name=None)

Source from the content-addressed store, hash-verified

181# ======================================================================
182
183def obtain_act(name=None):
184 """
185 Return activation function module
186 """
187 if name == 'relu':
188 act = nn.ReLU(inplace=True)
189 elif name == "gelu":
190 act = nn.GELU()
191 elif name == "prelu":
192 act = nn.PReLU()
193 elif name == "elu":
194 act = nn.ELU()
195 elif name == "leakyrelu":
196 act = nn.LeakyReLU()
197 elif name is None:
198 act = nn.Identity()
199 else:
200 raise NotImplementedError("{} is not implemented.".format(name))
201
202 return act
203
204
205def obtain_norm(name):

Callers 2

__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected