You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
434 B
17 lines
434 B
from utils import Registry, build_from_cfg
|
|
|
|
NET = Registry('net')
|
|
|
|
def build(cfg, registry, default_args=None):
|
|
if isinstance(cfg, list):
|
|
modules = [
|
|
build_from_cfg(cfg_, registry, default_args) for cfg_ in cfg
|
|
]
|
|
return nn.Sequential(*modules)
|
|
else:
|
|
return build_from_cfg(cfg, registry, default_args)
|
|
|
|
|
|
def build_net(cfg):
|
|
return build(cfg.net, NET, default_args=dict(cfg=cfg))
|