Output Handlers¶
-
class
ignite_framework.output_handlers.base_output_handler.
BaseOutputHandler
(input_ref, name='')[source]¶ -
name
= 'BaseOutputHandler'¶
-
output
¶ StateVariable is the basic state variable without any additional type checking or setting conditions.
Features:
gets/sets/calls a _value and gets/sets/calls a list of callbacks which are callables triggered when _value is set
overloaded suffixes: [‘_callbacks’, _ref’, ‘_every’, ‘_once’]
- _ref: returns StateObjectsReference-instance of itself
- _callbacks: returns list of callbacks (functions called when value is set)
set-value type dependent __set__() overload:
- CALLABLE_TYPES & tuple`([<CALLABLE_TYPES>, <dict>]): appended to its `_callbacks-list
- any other type: sets its _value
state shortcut auto-generation
-
-
class
ignite_framework.output_handlers.output_handlers.
OutputHandler
(input_refs, output_handler_name='', transform_input_func='', transform_output_func='', caller_refs='input_refs', lazy_output_initial_value='', warn_type_errors=True)[source]¶ Output handler that transforms the output of e.g. a model inference/update, a metric, etc..
The transformation can be anything, e.g. a type casting or mathematical operation. Only restriction, the transformation takes only 1 input (reference) and generates only 1 output self.output. If input_refs is a list of input references then OutputHandler will generate multiple OutputHandlers each transforming 1-to-1 input-to-output.
Parameters: - input_refs (StateObjectsReference) – input to be transformed, e.g. state.model.output
- output_handler_name (str) – name of output handler instance, with default ‘’ auto-generates default name for output handler depending on input_ref and transformation function names
- transform_input_func (callable) – transformation function that transforms the input value before self.output is set with it. transform_input_func is preferred over transform_output_func in case the transformation is rather cheap and the transformed value requires low(er) memory (than the untransformed value).
- transform_output_func (callable) – transformation function that transforms the self.output value when self.output is get. So this corresponds to a lazy descriptor, as the value is actually set untransformed and only transformed if it is get. transform_output_func is preferred over transform_input_func in case the transformation is rather expensive and the transformed value requires high(er) memory (than the untransformed value).
- caller_refs ('', None, SateObjectsReference) – reference of the BaseStateObject() that calls self.run(). Input case: * ‘’: default value, means self.run is appended to input_ref.caller_name * None: self.run is not appended at all during initialization. Appending must be done manually afterwards, otherwise self won’t be called at all * StateObjectsReference: self.run is attached to caller_ref.caller_name
- lazy_output_initial_value – initial value of self.output that must be of appropriate type and value to be processed by transform_output_func (and transform_input_func if set). It is only required if transform_output_func is set.
-
get
(*name_or_parts)¶ Get method for parameterized attribute names, especially for state object containers, but not only.
Main reason is to simply avoid unhandy commands, e.g. getattr(state.transitions, ‘{}_{}’.format(name, suffix) commands and simply write state.transitions.get(name, suffix).
-
get_bso_names
()¶
-
name
= 'OutputHandler'¶
-
output
¶ StateVariable is the basic state variable without any additional type checking or setting conditions.
Features:
gets/sets/calls a _value and gets/sets/calls a list of callbacks which are callables triggered when _value is set
overloaded suffixes: [‘_callbacks’, _ref’, ‘_every’, ‘_once’]
- _ref: returns StateObjectsReference-instance of itself
- _callbacks: returns list of callbacks (functions called when value is set)
set-value type dependent __set__() overload:
- CALLABLE_TYPES & tuple`([<CALLABLE_TYPES>, <dict>]): appended to its `_callbacks-list
- any other type: sets its _value
state shortcut auto-generation
-
set
(*name_or_parts_and_value)¶
-
class
ignite_framework.output_handlers.output_handlers.
ScalarsChartOutputHandler
(input_refs, output_handler_name='', transform_input_func='', transform_output_func='', caller_refs='input_refs', lazy_output_initial_value='', ignore_value_type_error=True)[source]¶ -
name
= 'ScalarsChartOutputHandler'¶
-
output
¶ StateVariable is the basic state variable without any additional type checking or setting conditions.
Features:
gets/sets/calls a _value and gets/sets/calls a list of callbacks which are callables triggered when _value is set
overloaded suffixes: [‘_callbacks’, _ref’, ‘_every’, ‘_once’]
- _ref: returns StateObjectsReference-instance of itself
- _callbacks: returns list of callbacks (functions called when value is set)
set-value type dependent __set__() overload:
- CALLABLE_TYPES & tuple`([<CALLABLE_TYPES>, <dict>]): appended to its `_callbacks-list
- any other type: sets its _value
state shortcut auto-generation
-