pytorch_pfn_extras.training.triggers.OnceTrigger#

class pytorch_pfn_extras.training.triggers.OnceTrigger(call_on_resume=False)#

Bases: Trigger

Trigger based on the starting point of the iteration.

This trigger accepts only once at starting point of the iteration. There are two ways to specify the starting point: only starting point in whole iteration or called again when training resumed.

Parameters:

call_on_resume (bool) – Whether the extension is called again or not when restored from a snapshot. It is set to False by default.

finished#

Flag that indicates whether or not this trigger will

Type:

bool

fire in the future. This flag is used to determine if the extension
should be initialized after resume.

Methods

__init__([call_on_resume])

load_state_dict(to_load)

may_fire(iteration, epoch_length)

Flags if the trigger may fire at the current iteration

state_dict()

Attributes

finished

__call__(manager)#

Call self as a function.

Parameters:

manager (ExtensionsManagerProtocol) –

Return type:

bool

__init__(call_on_resume=False)#
Parameters:

call_on_resume (bool) –

Return type:

None

property finished: bool#
load_state_dict(to_load)#
Parameters:

to_load (Dict[str, Any]) –

Return type:

None

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

state_dict()#
Return type:

Dict[str, Any]