neuralmonkey.config.builder module¶
Configuration Object Builder.
This module is responsible for instantiating objects specified by the experiment configuration.
-
class
neuralmonkey.config.builder.
ClassSymbol
(string: str) → None¶ Bases:
object
Represents a class (or other callable) in configuration.
-
__init__
(string: str) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
create
() → Any¶
-
-
class
neuralmonkey.config.builder.
ObjectRef
(expression: str) → None¶ Bases:
object
Represents a named object or its attribute in configuration.
-
__init__
(expression: str) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
bind
(value: Any)¶
-
target
¶
-
-
neuralmonkey.config.builder.
build_config
(config_dicts: Dict[str, Any], ignore_names: Set[str], warn_unused: bool = False) → Tuple[Dict[str, Any], Dict[str, Any]]¶ Build the model from the configuration.
Parameters: - config_dicts – The parsed configuration file
- ignore_names – A set of names that should be ignored during the loading.
- warn_unused – Emit a warning if there are unused sections.
Returns: A tuple containing a dictionary corresponding to the main section and a dictionary mapping section names to objects.
-
neuralmonkey.config.builder.
build_object
(value: str, all_dicts: Dict[str, Any], existing_objects: Dict[str, Any], depth: int) → Any¶ Build an object from config dictionary of its arguments.
Works recursively.
Parameters: - value – Value that should be resolved (either a literal value or a config section name)
- all_dicts – Configuration dictionaries used to find configuration of unconstructed objects.
- existing_objects – Dictionary of already constructed objects.
- depth – The current depth of recursion. Used to prevent an infinite
- recursion. –
-
neuralmonkey.config.builder.
instantiate_class
(name: str, all_dicts: Dict[str, Any], existing_objects: Dict[str, Any], depth: int) → Any¶ Instantiate a class from the configuration.
Arguments: see help(build_object)