Trainer extension to unchain all comptational graphs.
This extenstion unchains all comptational graphs after all extensions are run to release memory and to avoid memory leak. This extension can be used as a last resort when there is an extension that use a variable graph and cannot release the graph in itself. It observes the previous
chainer.config.keep_graph_on_reportflag. The extension is triggered when the flag is turned on.
Invokes the extension.
Implementations should override this operator. This method is called at iterations which the corresponding trigger accepts.
trainer (Trainer) – Trainer object that calls this operator.
Finalizes the extension.
This method is called at the end of the training loop.
Initializes up the trainer state.
This method is called before entering the training loop. An extension that modifies the state of
Trainercan override this method to initialize it.
When the trainer has been restored from a snapshot, this method has to recover an appropriate part of the state of the trainer.
ExponentialShiftextension changes the optimizer’s hyperparameter at each invocation. Note that the hyperparameter is not saved to the snapshot; it is the responsibility of the extension to recover the hyperparameter. The
ExponentialShiftextension recovers it in its
initializemethod if it has been loaded from a snapshot, or just setting the initial value otherwise.
trainer (Trainer) – Trainer object that runs the training loop.
on_error(trainer, exc, tb)¶
Handles the error raised during training before finalization.
This method is called when an exception is thrown during the training loop, before finalize. An extension that needs different error handling from finalize, can override this method to handle errors.
Serializes the extension state.
It is called when a trainer that owns this extension is serialized. It serializes nothing by default.
tuple() -> empty tuple tuple(iterable) -> tuple initialized from iterable’s items
If the argument is a tuple, the return value is the same object.
Default name of the extension.
It is the name of the class by default. Implementation can override this property, or provide a class attribute to hide it.