chainer.testing.get_trainer_with_mock_updater(stop_trigger=(10, 'iteration'), iter_per_epoch=10, extensions=None)[source]

Returns a Trainer object with mock updater.

The returned trainer can be used for testing the trainer itself and the extensions. A mock object is used as its updater. The update function set to the mock correctly increments the iteration counts ( updater.iteration), and thus you can write a test relying on it.

  • stop_trigger – Stop trigger of the trainer.

  • iter_per_epoch – The number of iterations per epoch.

  • extensions – Extensions registered to the trainer.


Trainer object with a mock updater.