MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / _get_activation_fn

Function _get_activation_fn

semantic_sam/body/decoder/utils/utils.py:103–115  ·  view source on GitHub ↗

Return an activation function given a string

(activation)

Source from the content-addressed store, hash-verified

101
102
103def _get_activation_fn(activation):
104 """Return an activation function given a string"""
105 if activation == "relu":
106 return F.relu
107 if activation == "gelu":
108 return F.gelu
109 if activation == "glu":
110 return F.glu
111 if activation == "prelu":
112 return nn.PReLU()
113 if activation == "selu":
114 return F.selu
115 raise RuntimeError(F"activation should be relu/gelu, not {activation}.")
116
117
118def _get_clones(module, N, layer_share=False):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected