

def __init__(self, left_size, right_size, out_size, nobias=False, initialW=None, initial_bias=None):
    super(Bilinear, self).__init__(W=(left_size, right_size, out_size))
    self.in_sizes = (left_size, right_size)
    self.nobias = nobias
    if (initialW is not None):
        assert (initialW.shape == self.W.data.shape)
        self.W.data[...] = initialW
    else:
        in_size = ((left_size * right_size) * out_size)
        self.W.data[...] = numpy.random.normal(0, numpy.sqrt((1.0 / in_size)), self.W.data.shape)
    if (not self.nobias):
        self.add_param('V1', (left_size, out_size))
        self.add_param('V2', (right_size, out_size))
        self.add_param('b', out_size)
        if (initial_bias is not None):
            (V1, V2, b) = initial_bias
            assert (V1.shape == self.V1.data.shape)
            assert (V2.shape == self.V2.data.shape)
            assert (b.shape == self.b.data.shape)
            self.V1.data[...] = V1
            self.V2.data[...] = V2
            self.b.data[...] = b
        else:
            self.V1.data[...] = numpy.random.normal(0, numpy.sqrt((1.0 / left_size)), (left_size, out_size))
            self.V2.data[...] = numpy.random.normal(0, numpy.sqrt((1.0 / right_size)), (right_size, out_size))
            self.b.data.fill(0)

dataset/ETHPy150Open pfnet/chainer/chainer/links/connection/bilinear.py Bilinear.__init__/original