neon.util.yaml_parse

Tools for parsing neon model definition files (YAML formatted) and generating neon model objects from the definition.

Functions

create_objects(root_yaml[, be_type, …]) Instantiate objects as per the given specifications.
format_yaml_dict(yamldict, type_prefix) Helper function for format the YAML model config into
neon.util.yaml_parse.create_objects(root_yaml, be_type='gpu', batch_size=128, rng_seed=None, device_id=0, default_dtype=<class 'numpy.float32'>, stochastic_rounding=False)[source]

Instantiate objects as per the given specifications.

Parameters:
  • root_yaml (dict) – Model definition dictionary parse from YAML file
  • be_type (str) – backend either ‘gpu’, ‘mgpu’ or ‘cpu’
  • batch_size (int) – Batch size.
  • rng_seed (None or int) – random number generator seed
  • device_id (int) – for GPU backends id of device to use
  • default_dtype (type) – numpy data format for default data types,
  • stochastic_rounding (bool or int) – number of bits for stochastic rounding use False for no rounding
Returns:

Contains model, cost and optimizer objects.

Return type:

tuple

neon.util.yaml_parse.format_yaml_dict(yamldict, type_prefix)[source]

Helper function for format the YAML model config into the proper format for object and layer initialization

Parameters:
  • yamldict (dict) – dictionary with model parameters
  • type_prefix (str) – module path for this object
Returns:

formatted dict

Return type:

dict