MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / add

Method add

monai/utils/component_store.py:63–69  ·  view source on GitHub ↗

Store the object `value` under the name `name` with description `desc`.

(self, name: str, desc: str, value: T)

Source from the content-addressed store, hash-verified

61 self.__doc__ = f"Component Store '{name}': {description}\n{self.__doc__ or ''}".strip()
62
63 def add(self, name: str, desc: str, value: T) -> T:
64 """Store the object `value` under the name `name` with description `desc`."""
65 if not is_variable(name):
66 raise ValueError("Name of component must be valid Python identifier")
67
68 self.components[name] = self._Component(desc, value)
69 return value
70
71 def add_def(self, name: str, desc: str) -> Callable:
72 """Returns a decorator which stores the decorated function under `name` with description `desc`."""

Callers 15

decoMethod · 0.95
scan_setup_pyFunction · 0.80
check_key_duplicatesFunction · 0.80
construct_mappingMethod · 0.80
_onnx_to_trtMethod · 0.80
forwardMethod · 0.80
forwardMethod · 0.80
forwardMethod · 0.80
forwardMethod · 0.80
add_factory_callableMethod · 0.80
get_spatial_dimsFunction · 0.80
__init__Method · 0.80

Calls 1

is_variableFunction · 0.85

Tested by 11

discriminator_lossFunction · 0.64
run_training_testFunction · 0.64
discriminator_lossFunction · 0.64
test_addMethod · 0.64
test_add2Method · 0.64
test_addMethod · 0.64
test_outMethod · 0.64