

def bilinear(e1, e2, W, V1=None, V2=None, b=None):
    'Applies a bilinear function based on given parameters.\n\n    This is a building block of Neural Tensor Network (see the reference paper\n    below). It takes two input variables and one or four parameters, and\n    outputs one variable.\n\n    To be precise, denote six input arrays mathematically by\n    :math:`e^1\\in \\mathbb{R}^{I\\cdot J}`,\n    :math:`e^2\\in \\mathbb{R}^{I\\cdot K}`,\n    :math:`W\\in \\mathbb{R}^{J \\cdot K \\cdot L}`,\n    :math:`V^1\\in \\mathbb{R}^{J \\cdot L}`,\n    :math:`V^2\\in \\mathbb{R}^{K \\cdot L}`, and\n    :math:`b\\in \\mathbb{R}^{L}`,\n    where :math:`I` is mini-batch size.\n    In this document, we call :math:`V^1`, :math:`V^2`, and :math:`b` linear\n    parameters.\n\n    The output of forward propagation is calculated as\n\n    .. math::\n\n      y_{il} = \\sum_{jk} e^1_{ij} e^2_{ik} W_{jkl} + \\\n        \\sum_{j} e^1_{ij} V^1_{jl} + \\sum_{k} e^2_{ik} V^2_{kl} + b_{l}.\n\n    Note that V1, V2, b are optional. If these are not given, then this\n    function omits the last three terms in the above equation.\n\n    .. note::\n\n       This function accepts an input variable ``e1`` or ``e2`` of a non-matrix\n       array. In this case, the leading dimension is treated as the batch\n       dimension, and the other dimensions are reduced to one dimension.\n\n    .. note::\n\n       In the original paper, :math:`J` and :math:`K`\n       must be equal and the author denotes :math:`[V^1 V^2]`\n       (concatenation of matrices) by :math:`V`.\n\n    Args:\n        e1 (~chainer.Variable): Left input variable.\n        e2 (~chainer.Variable): Right input variable.\n        W (~chainer.Variable): Quadratic weight variable.\n        V1 (~chainer.Variable): Left coefficient variable.\n        V2 (~chainer.Variable): Right coefficient variable.\n        b (~chainer.Variable): Bias variable.\n\n    Returns:\n        ~chainer.Variable: Output variable.\n\n    See:\n        `Reasoning With Neural Tensor Networks for Knowledge Base Completion\n        <http://papers.nips.cc/paper/5028-reasoning-with-neural-tensor-\n        networks-for-knowledge-base-completion>`_ [Socher+, NIPS2013].\n\n    '
    flags = [(V1 is None), (V2 is None), (b is None)]
    if any(e2):
        if (not all(flags)):
            raise ValueError('All coefficients and bias for bilinear() must be None, if at least one of them is None.')
        return BilinearFunction()(e1, e2, W)
    else:
        return BilinearFunction()(e1, e2, W, V1, V2, b)

dataset/ETHPy150Open pfnet/chainer/chainer/functions/connection/bilinear.py bilinear/VarMisuse@53/973 `flags`->`e2`