

def check_type_forward(self, in_types):
    n_in = in_types.size().eval()
    if ((n_in != 3) and (n_in != 6)):
        raise type_check.InvalidType(('%s or %s' % ((in_types.size() == 3), (in_types.size() == 6))), ('%s == %s' % (in_types.size(), n_in)))
    (e1_type, e2_type, W_type) = in_types[:3]
    type_check_prod = type_check.Variable(numpy.prod, 'prod')
    type_check.expect((e1_type.dtype == numpy.float32), (e1_type.ndim >= 2), (e2_type.dtype == numpy.float32), (e2_type.ndim >= 2), (e1_type.shape[0] == e2_type.shape[0]), (W_type.dtype == numpy.float32), (W_type.ndim == 3), (type_check_prod(e1_type.shape[1:]) == W_type.shape[0]), (type_check_prod(e2_type.shape[1:]) == W_type.shape[1]))
    if (n_in == 6):
        out_size = W_type.shape[2]
        (V1_type, V2_type, b_type) = in_types[3:]
        type_check.expect((V1_type.dtype == numpy.float32), (V1_type.ndim == 2), (V1_type.shape[0] == W_type.shape[0]), (V1_type.shape[1] == out_size), (V2_type.dtype == numpy.float32), (V2_type.ndim == 2), (V2_type.shape[0] == W_type.shape[1]), (V2_type.shape[1] == out_size), (b_type.dtype == numpy.float32), (b_type.ndim == 1), (b_type.shape[0] == out_size))

dataset/ETHPy150Open pfnet/chainer/chainer/functions/connection/bilinear.py BilinearFunction.check_type_forward/original