MCPcopy
hub / github.com/snap-stanford/GraphGym / register_base

Function register_base

graphgym/register.py:23–46  ·  view source on GitHub ↗

r"""Base function for registering a module in GraphGym. Args: mapping (dict): Python dictionary to register the module. hosting all the registered modules key (string): The name of the module. module (any, optional): The module. If set to :obj:`None`, will re

(mapping: Dict[str, Any],
                  key: str,
                  module: Any = None)

Source from the content-addressed store, hash-verified

21
22
23def register_base(mapping: Dict[str, Any],
24 key: str,
25 module: Any = None) -> Union[None, Callable]:
26 r"""Base function for registering a module in GraphGym.
27
28 Args:
29 mapping (dict): Python dictionary to register the module.
30 hosting all the registered modules
31 key (string): The name of the module.
32 module (any, optional): The module. If set to :obj:`None`, will return
33 a decorator to register a module.
34 """
35 if module is not None:
36 if key in mapping:
37 raise KeyError(f"Module with '{key}' already defined")
38 mapping[key] = module
39 return
40
41 # Other-wise, use it as a decorator:
42 def bounded_register(module):
43 register_base(mapping, key, module)
44 return module
45
46 return bounded_register
47
48
49def register_act(key: str, module: Any = None):

Callers 15

bounded_registerFunction · 0.85
register_actFunction · 0.85
register_node_encoderFunction · 0.85
register_edge_encoderFunction · 0.85
register_stageFunction · 0.85
register_headFunction · 0.85
register_layerFunction · 0.85
register_poolingFunction · 0.85
register_networkFunction · 0.85
register_configFunction · 0.85
register_datasetFunction · 0.85
register_loaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected