def check_forward(self, x_data):
x = chainer.Variable(x_data)
y = functions.hard_sigmoid(x)
self.assertIs(y.data.dtype, x_data.dtype)
expect = numpy.minimum(1.0, numpy.maximum(0.0, self.x * 0.2 + 0.5))
gradient_check.assert_allclose(
y.data, expect, **self.check_forward_option)
评论列表
文章目录