def check_forward(self, x_data):
x = chainer.Variable(x_data)
y = functions.expand_dims(x, self.axis)
self.assertEqual(y.data.shape, self.out_shape)
y_expect = numpy.expand_dims(cuda.to_cpu(x_data), self.axis)
self.assertEqual(y.data.dtype, self.dtype)
numpy.testing.assert_array_equal(cuda.to_cpu(y.data), y_expect)
评论列表
文章目录