Engines¶
-
class
ignite_framework.engines.base_engine.
BaseEngine
(name)[source]¶ Baseclass for all engines. Automatically assigns the instance to state.engines when instantiated.
Parameters: name – -
name
= 'BaseEngine'¶
-
-
class
ignite_framework.engines.engines.
Engine
(name, process, dataloader=None, engine_run_started_ref=None, n_samples=None, n_epochs=4)[source]¶ The default engine.
Parameters: - name –
- process –
- dataloader –
- engine_run_started_ref – state object to which’s callbacks Engine().run will be added/attached
- n_samples –
- n_epochs –
-
batch
¶ StateObject is a data-descriptor that stores any value in state.
Features:
” overloaded suffix: _ref ” state shortcut auto-generation
-
engine_run_completed
¶ Type selective state variable of type
bool
.
-
engine_run_started
¶ Type selective state variable of type
bool
.
-
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
()¶
-
n_epoch_completed
¶ Iteration counter is a state variable, only allowing ‘’int’’ with increasing values by step size ‘+`1`.
-
n_epoch_started
¶ Iteration counter is a state variable, only allowing ‘’int’’ with increasing values by step size ‘+`1`.
-
n_iteration_completed
¶ Iteration counter is a state variable, only allowing ‘’int’’ with increasing values by step size ‘+`1`.
-
n_iteration_started
¶ Iteration counter is a state variable, only allowing ‘’int’’ with increasing values by step size ‘+`1`.
-
n_samples
¶ Type and value selective state variable only allowing type
int
and increasing values.
-
name
= 'Engine'¶
-
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
-
process
()[source]¶ Process function executed in each iteration step.
self.process is overwritten during initialization by process argument
Returns: no return, all results are passed to self.output
-
run
(dataloader=None)[source]¶ Called to start process loop (start engine). run is added to the engine_run_started_ref callbacks during intialization.
Parameters: - dataloader – Only required if dataloader was not set during intialization or initial dataloader
- be overwritten (should) –
Returns:
-
set
(*name_or_parts_and_value)¶
-
terminating_epoch
¶ Type selective state variable of type
bool
.
-
terminating_run
¶ Type selective state variable of type
bool
.