neural_compressor.conf.dotdict

Module Contents

Classes

DotDict

access yaml using attributes instead of using the dictionary notation.

Functions

deep_get(dictionary, keys[, default])

get the dot key's item in nested dict

deep_set(dictionary, keys, value)

set the dot key's item in nested dict

neural_compressor.conf.dotdict.deep_get(dictionary, keys, default=None)

get the dot key’s item in nested dict eg person = {‘person’:{‘name’:{‘first’:’John’}}} deep_get(person, “person.name.first”) will output ‘John’

Parameters:
  • dictionary (dict) – The dict object to get keys

  • keys (dict) – The deep keys

  • default (object) – The return item if key not exists

Returns:

the item of the deep dot keys

Return type:

item

neural_compressor.conf.dotdict.deep_set(dictionary, keys, value)

set the dot key’s item in nested dict eg person = {‘person’:{‘name’:{‘first’:’John’}}} deep_set(person, “person.sex”, ‘male’) will output {‘person’: {‘name’: {‘first’: ‘John’}, ‘sex’: ‘male’}}

Parameters:
  • dictionary (dict) – The dict object to get keys

  • keys (dict) – The deep keys

  • value (object) – The value of the setting key

class neural_compressor.conf.dotdict.DotDict(value=None)

Bases: dict

access yaml using attributes instead of using the dictionary notation.

Parameters:

value (dict) – The dict object to access.