MCPcopy
hub / github.com/Fafa-DL/Awesome-Backbones / build_activation_layer

Function build_activation_layer

configs/basic/build_layer.py:151–164  ·  view source on GitHub ↗

Build activation layer. Args: cfg (dict): The activation layer config, which should contain: - type (str): Layer type. - layer args: Args needed to instantiate an activation layer. Returns: nn.Module: Created activation layer.

(cfg)

Source from the content-addressed store, hash-verified

149 return name,layer
150
151def build_activation_layer(cfg):
152 """Build activation layer.
153
154 Args:
155 cfg (dict): The activation layer config, which should contain:
156
157 - type (str): Layer type.
158 - layer args: Args needed to instantiate an activation layer.
159
160 Returns:
161 nn.Module: Created activation layer.
162 """
163 cfg_ = copy.deepcopy(cfg)
164 return eval(cfg_.pop('type'))(**cfg_)
165
166def build_padding_layer(cfg, *args, **kwargs):
167 """Build padding layer.

Callers 15

__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
_init_layersMethod · 0.90
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected