pytorch_pfn_extras.training.triggers.ManualScheduleTrigger#
- class pytorch_pfn_extras.training.triggers.ManualScheduleTrigger(points, unit)#
Bases:
Trigger
Trigger invoked at specified point(s) of iterations or epochs.
This trigger accepts iterations or epochs indicated by given point(s). There are two ways to specify the point(s): iteration and epoch.
iteration
means the number of updates, whileepoch
means the number of sweeps over the training dataset. Fractional values are allowed if the point is a number of epochs; the trigger uses theiteration
andepoch_detail
attributes defined by the manager.- Parameters:
points (int, float, or list of int or float) – time of the trigger. Must be an integer or list of integer if unit is
'iteration'
.unit (str) – Unit of the time specified by
points
. It must be either'iteration'
or'epoch'
.
Methods
__init__
(points, unit)load_state_dict
(state)may_fire
(iteration, epoch_length)Flags if the trigger may fire at the current iteration
state_dict
()- __call__(manager)#
Decides whether the extension should be called on this iteration.
- Parameters:
manager (ExtensionsManager) – Manager object that this trigger is associated with. The iteration information in this manager is used to determine if the trigger should fire.
- Returns:
True if the corresponding extension should be invoked in this iteration.
- Return type:
bool
- __init__(points, unit)#
- Parameters:
points (Union[float, Sequence[float]]) –
unit (UnitLiteral) –
- may_fire(iteration, epoch_length)#
Flags if the trigger may fire at the current iteration
This must not alter the trigger state
- Parameters:
iteration (int) –
epoch_length (int) –
- Return type:
bool