本文整理汇总了Python中chainer.gradient_check.check_backward方法的典型用法代码示例。如果您正苦于以下问题:Python gradient_check.check_backward方法的具体用法?Python gradient_check.check_backward怎么用?Python gradient_check.check_backward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chainer.gradient_check
的用法示例。
在下文中一共展示了gradient_check.check_backward方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_backward
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def check_backward(self, x_data, y_grad):
gradient_check.check_backward(
chainerrl.functions.WeightedSumArrays(self.weights),
x_data, y_grad, eps=1e-2, rtol=1e-2)
示例2: test_backward_cpu
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def test_backward_cpu(self):
self.check_backward(self.xs, self.gy)
示例3: test_backward_gpu
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def test_backward_gpu(self):
xs_gpu = [chainer.cuda.to_gpu(x) for x in self.xs]
self.check_backward(xs_gpu, cuda.to_gpu(self.gy))
示例4: check_backward
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def check_backward(self, x_data, y_grad):
gradient_check.check_backward(
LowerTriangularMatrix(),
x_data, y_grad, eps=1e-2, rtol=1e-2)
示例5: test_backward_cpu
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def test_backward_cpu(self):
self.check_backward((self.diag, self.non_diag), self.gy)
示例6: check_backward
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def check_backward(self, x_data, y_grad):
gradient_check.check_backward(
chainerrl.functions.SumArrays(),
x_data, y_grad, eps=1e-2, rtol=1e-2)
示例7: check_backward
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def check_backward(self, x_data, y_grad, chain):
gradient_check.check_backward(
chain, x_data, y_grad, (chain.l1.W, chain.l1.b),
dtype='f', **self.check_backward_options)
示例8: test_backward_cpu
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def test_backward_cpu(self):
chain = self.static_chain
with configuration.using_config('train', False):
self.check_backward(self.x, self.gy, chain)
示例9: check_backward
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def check_backward(self, x_data, b_data, y_grad):
if b_data is None:
params = [self.link.b]
gradient_check.check_backward(
self.link, x_data, y_grad, params, atol=1e-2)
else:
gradient_check.check_backward(
self.link, (x_data, b_data), y_grad, atol=1e-2)
示例10: test_backward_gpu
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def test_backward_gpu(self):
with testing.assert_warns(DeprecationWarning):
self.link.to_gpu()
x = cuda.to_gpu(self.x)
if self.learn_b:
b = None
else:
b = cuda.to_gpu(self.b)
gy = cuda.to_gpu(self.gy)
self.check_backward(x, b, gy)
示例11: check_backward
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def check_backward(self, x_data, y_grad):
if self.nobias:
params = (self.link.deform_conv.W)
else:
params = (self.link.deform_conv.W, self.link.deform_conv.b)
gradient_check.check_backward(
self.link, x_data,
y_grad, params,
eps=2 ** -3, atol=1e-3, rtol=1e-3)
示例12: test_backward_cpu
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def test_backward_cpu(self):
self.check_backward(self.x, self.gy)
示例13: test_backward_gpu
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def test_backward_gpu(self):
with testing.assert_warns(DeprecationWarning):
self.link.to_gpu()
self.check_backward(cuda.to_gpu(self.x),
cuda.to_gpu(self.gy))
示例14: check_backward
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def check_backward(self, x_data, y_grad):
gradient_check.check_backward(
self.link, x_data, y_grad, (self.link.W, self.link.b),
dtype='d', **self.check_backward_options)
示例15: test_backward_gpu
# 需要导入模块: from chainer import gradient_check [as 别名]
# 或者: from chainer.gradient_check import check_backward [as 别名]
def test_backward_gpu(self):
with testing.assert_warns(DeprecationWarning):
self.link.to_gpu()
self.check_backward(cuda.to_gpu(self.x), cuda.to_gpu(self.gy))