本文整理匯總了Python中chainer.training.Extension方法的典型用法代碼示例。如果您正苦於以下問題:Python training.Extension方法的具體用法?Python training.Extension怎麽用?Python training.Extension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類chainer.training
的用法示例。
在下文中一共展示了training.Extension方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_raise_error_if_call_not_implemented
# 需要導入模塊: from chainer import training [as 別名]
# 或者: from chainer.training import Extension [as 別名]
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)
示例2: test_default_name
# 需要導入模塊: from chainer import training [as 別名]
# 或者: from chainer.training import Extension [as 別名]
def test_default_name(self):
class MyExtension(training.Extension):
pass
ext = MyExtension()
self.assertEqual(ext.default_name, 'MyExtension')
示例3: test_deleted_invoke_before_training
# 需要導入模塊: from chainer import training [as 別名]
# 或者: from chainer.training import Extension [as 別名]
def test_deleted_invoke_before_training(self):
class MyExtension(training.Extension):
pass
ext = MyExtension()
with self.assertRaises(AttributeError):
ext.invoke_before_training