def setUp(self):
self.gamma = numpy.random.uniform(.5, 1, (3,)).astype(self.dtype)
self.beta = numpy.random.uniform(-1, 1, (3,)).astype(self.dtype)
self.expander = (None, Ellipsis) + (None,) * self.ndim
shape = (7, 3) + (2,) * self.ndim
self.x = numpy.random.uniform(-1, 1, shape).astype(self.dtype)
self.gy = numpy.random.uniform(-1, 1, shape).astype(self.dtype)
self.eps = 1e-5
self.aggr_axes = (0,) + tuple(six.moves.range(2, self.ndim + 2))
self.mean = numpy.random.uniform(-1, 1, (3,)).astype(self.dtype)
self.var = numpy.random.uniform(
0.5, 1, (3,)).astype(self.dtype)
self.args = [self.x, self.gamma, self.beta, self.mean, self.var]
self.check_forward_optionss = {'atol': 1e-4, 'rtol': 1e-3}
self.check_backward_optionss = {'atol': 1e-4, 'rtol': 1e-3}
if self.dtype == numpy.float16:
self.check_forward_optionss = {'atol': 1e-3, 'rtol': 1e-2}
self.check_backward_optionss = {'atol': 5e-2, 'rtol': 1e-1}
test_batch_normalization.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录