• Docs >
  • framework.framework_utils
Shortcuts

framework.framework_utils

class ignite_framework.framework.framework_utils.CallbacksList[source]
__dict__ = mappingproxy({'__module__': 'ignite_framework.framework.framework_utils', '__setitem__': <function CallbacksList.__setitem__>, 'append': <function CallbacksList.append>, '_type_check_and_format': <function CallbacksList._type_check_and_format>, 'reorder': <function CallbacksList.reorder>, '_raise_error': <function CallbacksList._raise_error>, '__dict__': <attribute '__dict__' of 'CallbacksList' objects>, '__weakref__': <attribute '__weakref__' of 'CallbacksList' objects>, '__doc__': None})
__module__ = 'ignite_framework.framework.framework_utils'
__setitem__(key, value)[source]

Set self[key] to value.

__weakref__

list of weak references to the object (if defined)

_raise_error(object)[source]
_type_check_and_format(object)[source]
append(object)[source]

Redundant type checking to BaseCallbackiverloadsStateObject as the callback list is exposed to the user for full list functionality. :param object:

Returns:

reorder(order_idcs)[source]
class ignite_framework.framework.framework_utils.DecoratorAndAttributeToItemDictionary[source]
__call__(func)[source]

Call self as a function.

__dict__ = mappingproxy({'__module__': 'ignite_framework.framework.framework_utils', '__init__': <function DecoratorAndAttributeToItemDictionary.__init__>, '__call__': <function DecoratorAndAttributeToItemDictionary.__call__>, '__getattr__': <function DecoratorAndAttributeToItemDictionary.__getattr__>, '__setattr__': <function DecoratorAndAttributeToItemDictionary.__setattr__>, '__dict__': <attribute '__dict__' of 'DecoratorAndAttributeToItemDictionary' objects>, '__weakref__': <attribute '__weakref__' of 'DecoratorAndAttributeToItemDictionary' objects>, '__doc__': None})
__getattr__(key)[source]
__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'ignite_framework.framework.framework_utils'
__setattr__(key, value)[source]

Implement setattr(self, name, value).

__weakref__

list of weak references to the object (if defined)

class ignite_framework.framework.framework_utils.OrderedSingleKeyAssignmentDict[source]
__module__ = 'ignite_framework.framework.framework_utils'
class ignite_framework.framework.framework_utils.SingleKeyAssignmentDict[source]
__dict__ = mappingproxy({'__module__': 'ignite_framework.framework.framework_utils', '__dict__': <attribute '__dict__' of 'SingleKeyAssignmentDict' objects>, '__weakref__': <attribute '__weakref__' of 'SingleKeyAssignmentDict' objects>, '__doc__': None})
__module__ = 'ignite_framework.framework.framework_utils'
__weakref__

list of weak references to the object (if defined)

class ignite_framework.framework.framework_utils.SingleKeyAssignmentDictMixin[source]
__delitem__(key)[source]
__dict__ = mappingproxy({'__module__': 'ignite_framework.framework.framework_utils', '__setitem__': <function SingleKeyAssignmentDictMixin.__setitem__>, '__delitem__': <function SingleKeyAssignmentDictMixin.__delitem__>, '__dict__': <attribute '__dict__' of 'SingleKeyAssignmentDictMixin' objects>, '__weakref__': <attribute '__weakref__' of 'SingleKeyAssignmentDictMixin' objects>, '__doc__': None})
__module__ = 'ignite_framework.framework.framework_utils'
__setitem__(key, value)[source]
__weakref__

list of weak references to the object (if defined)

ignite_framework.framework.framework_utils.bases_have_attr(bases, name)[source]
ignite_framework.framework.framework_utils.check_if_tuple_is_callback_and_reformat(value)[source]

Identify if value as new callback before it is appended to a callback list of e.g. a StateVariable or StateParameter.

Implemented to return quickly in case value is not a new callback. :param instance: :param value:

Returns:

ignite_framework.framework.framework_utils.get_argument_name_from_frame_inspection(name, obj, default_name='obj')[source]
ignite_framework.framework.framework_utils.get_component_attr(self, instance, owner)[source]

‘instance_attr__get__` method for state component integrating a simple attribute with name ``self.name`` of a PyTorch class instance (or any external class), e.g. integrating Module.training as state parameter in the state component state.modules.model.

Parameters:
  • selfBaseStateObject (e.g. StateVariable())instance or subclass instance that integrates the relevant state component attributes with state.
  • instanceBaseStateObject container (e.g. state.engines)
  • owner – The owner class holding/owning self
Returns:

attribute of state component

ignite_framework.framework.framework_utils.get_module_component_device(self, instance, owner)[source]

The ‘instance_attr__get__` method for the state component integrating the parameter device (self.name)

Parameters:
  • instance – the state object instance (data descriptor instance attached to the class of self)
  • owner – the class of self (self.__class__)
Returns:

current device of the module instance self.component

ignite_framework.framework.framework_utils.namespace_decorator(name, bases, namespace)[source]
ignite_framework.framework.framework_utils.raise_or_warn_abstract_method_not_implemented_error(instance, method, error_or_warn=<class 'ignite_framework.exceptions.feature_exceptions.FeatureNotImplementedError'>)[source]
ignite_framework.framework.framework_utils.raise_run_not_implemented_and_appendable_to_callback_error(transition)[source]
ignite_framework.framework.framework_utils.reformat_as_list(*args)[source]
ignite_framework.framework.framework_utils.set_component_attr(self, instance, value)[source]

instance_attr__set__ function for BaseStateObject to integrate StateComponent attributes in state.

Parameters:
  • selfBaseStateObject (e.g. StateVariable()) instance or subclass instance that integrates the relevant state compoment attributes with state.
  • instanceBaseStateObject container (e.g. state.engines)
  • value – value to be set
ignite_framework.framework.framework_utils.set_module_component_device(self, instance, value)[source]

The instance_attr__set__ method for a state component integrating the parameter device of a PyTorch class (Module).

Actually, the PyTorch class method \*.to(device=...) is integrated as there is not direct parameter device in e.g. torch.nn.Module.

Parameters:
  • instance – the state object instance (data descriptor instance attached to the class of self)
  • value – the value to set the instance’s component’s attribute self.name (==device)