import unittest

from chainer import cuda
from chainer import initializers
from chainer import testing
from chainer.testing import attr
import numpy


class UniformBase(object):

    shape = (2, 3, 4)

    def check_initializer(self, w):
        self.initializer(w)
        self.assertTupleEqual(w.shape, self.shape)
        self.assertEqual(w.dtype, numpy.float32)
        xp = cuda.get_array_module(w)
        self.assertIsInstance(w, xp.ndarray)

    def test_initializer_cpu(self):
        w = numpy.empty(self.shape, dtype=numpy.float32)
        self.check_initializer(w)

    @attr.gpu
    def test_initializer_gpu(self):
        w = cuda.cupy.empty(self.shape, dtype=numpy.float32)
        self.check_initializer(w)


class TestUniform(unittest.TestCase, UniformBase):

    def setUp(self):
        self.initializer = initializers.Uniform(scale=0.1)


class TestLeCunUniform(unittest.TestCase, UniformBase):

    def setUp(self):
        self.initializer = initializers.LeCunUniform(scale=0.1)


class TestGlorotUniform(unittest.TestCase, UniformBase):

    def setUp(self):
        self.initializer = initializers.GlorotUniform(scale=0.1)


class TestHeUniform(unittest.TestCase, UniformBase):

    def setUp(self):
        self.initializer = initializers.HeUniform(scale=0.1)


testing.run_module(__name__, __file__)

@@ -148,32 +148,296 @@
 y%0A%0A%0A
-class UniformBase(object
+@testing.parameterize(%0A    %7B'initializer': initializers.Uniform(scale=0.1)%7D,%0A    %7B'initializer': initializers.LeCunUniform(scale=0.1)%7D,%0A    %7B'initializer': initializers.GlorotUniform(scale=0.1)%7D,%0A    %7B'initializer': initializers.HeUniform(scale=0.1)%7D%0A)%0Aclass TestUniform(unittest.TestCase
 ):%0A%0A
@@ -938,32 +938,32 @@
 =numpy.float32)%0A
+
         self.che
@@ -986,570 +986,8 @@
 )%0A%0A%0A
-class TestUniform(unittest.TestCase, UniformBase):%0A%0A    def setUp(self):%0A        self.initializer = initializers.Uniform(scale=0.1)%0A%0A%0Aclass TestLeCunUniform(unittest.TestCase, UniformBase):%0A%0A    def setUp(self):%0A        self.initializer = initializers.LeCunUniform(scale=0.1)%0A%0A%0Aclass TestGlorotUniform(unittest.TestCase, UniformBase):%0A%0A    def setUp(self):%0A        self.initializer = initializers.GlorotUniform(scale=0.1)%0A%0A%0Aclass TestHeUniform(unittest.TestCase, UniformBase):%0A%0A    def setUp(self):%0A        self.initializer = initializers.HeUniform(scale=0.1)%0A%0A%0A
 test

Use parameterized test