Python chainer.training.Extension() Examples

The following are 3 code examples of chainer.training.Extension(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module chainer.training , or try the search function .
Example #1
Source File: test_extension.py    From chainer with MIT License 5 votes vote down vote up
def test_raise_error_if_call_not_implemented(self):
        class MyExtension(training.Extension):
            pass

        ext = MyExtension()
        trainer = testing.get_trainer_with_mock_updater()
        with pytest.raises(NotImplementedError):
            ext(trainer) 
Example #2
Source File: test_extension.py    From chainer with MIT License 5 votes vote down vote up
def test_default_name(self):
        class MyExtension(training.Extension):
            pass

        ext = MyExtension()
        self.assertEqual(ext.default_name, 'MyExtension') 
Example #3
Source File: test_extension.py    From chainer with MIT License 5 votes vote down vote up
def test_deleted_invoke_before_training(self):
        class MyExtension(training.Extension):
            pass

        ext = MyExtension()
        with self.assertRaises(AttributeError):
            ext.invoke_before_training