mindformers.core.get_context
- mindformers.core.get_context(attr_key)[source]
Get context attribute value according to the input key. If some attributes are not set, they will be automatically obtained.
- Parameters
attr_key (str) – The key of the attribute.
- Returns
Object, The value of given attribute key.
- Raises
ValueError – If input key is not an attribute in context.
Examples
>>> from mindformers import build_context, get_context >>> config = {'context': {'mode': 'GRAPH_MODE'}, 'parallel':{}} >>> build_context(config=config) >>> get_context('max_device_memory')