我们从Python开源项目中,提取了以下14个代码示例,用于说明如何使用chainer.functions.maxout()。
def __call__(self, x): return functions.maxout(x, self.pool_size)
def check_forward(self, x_data): x = chainer.Variable(x_data) y = functions.maxout(x, self.pool_size, self.axis) self.assertEqual(y.data.dtype, self.dtype) gradient_check.assert_allclose(self.y, y.data)
def check_backward(self, x_data, y_grad): gradient_check.check_backward( lambda x: functions.maxout(x, self.pool_size, self.axis), x_data, y_grad, eps=0.125)
def test_invalid_shape_cpu(self): with self.assertRaises(self.error): functions.maxout(self.x, self.pool_size)
def test_invalid_shape_gpu(self): self.x.to_gpu() with self.assertRaises(self.error): functions.maxout(self.x, self.pool_size)
def __init__(self, pool_size, axis=1): self._function = "maxout" self.pool_size = pool_size self.axis = axis
def __call__(self, x): return F.maxout(x, self.pool_size, self.axis)