Module Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr If BoolOpAnd CompareNotEq NameLoad Num CompareNotEq NameLoad Num body Raise Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad CompareEq Call AttributeLoad NameLoad attr Num CompareEq Call AttributeLoad NameLoad attr Num BinOpMod Str TupleLoad Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore NameStore SubscriptLoad NameLoad Slice Num Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareGtE AttributeLoad NameLoad attr Num CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareGtE AttributeLoad NameLoad attr Num CompareEq SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr Num CompareEq Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Slice Num SubscriptLoad AttributeLoad NameLoad attr Index Num CompareEq Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Slice Num SubscriptLoad AttributeLoad NameLoad attr Index Num If CompareEq NameLoad Num body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num Assign TupleStore NameStore NameStore NameStore SubscriptLoad NameLoad Slice Num Expr Call AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr Num CompareEq SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num CompareEq SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr Num CompareEq SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num CompareEq SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr Num CompareEq SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad NameLoad NameLoad orelse Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore BinOpMult SubscriptLoad NameLoad ExtSlice Slice Slice Index NameLoad SubscriptLoad NameLoad ExtSlice Slice Index NameLoad Slice Assign NameStore Call AttributeLoad NameLoad attr NameLoad BinOpMult NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Num SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareEq Call NameLoad NameLoad Num body Assign TupleStore NameStore NameStore NameStore SubscriptLoad NameLoad Slice Num AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore NameLoad Return TupleLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad NameLoad NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr Str Str Str Str Str Num Str Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Slice Index NameLoad Index NameLoad Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Index NameLoad Slice Index NameLoad Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Index NameLoad Index NameLoad Slice Assign NameStore SubscriptLoad NameLoad ExtSlice Index NameLoad Slice Slice Slice Assign NameStore Call NameLoad NameLoad NameLoad NameLoad keyword Num Assign NameStore Call NameLoad NameLoad NameLoad NameLoad keyword TupleLoad Num Num Assign NameStore Call NameLoad NameLoad NameLoad NameLoad keyword TupleLoad Num Num Assign NameStore TupleLoad Call AttributeLoad NameLoad attr AttributeLoad SubscriptLoad NameLoad Index Num attr Call AttributeLoad NameLoad attr AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad If CompareEq Call NameLoad NameLoad Num body Assign TupleStore NameStore NameStore NameStore SubscriptLoad NameLoad Slice Num Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Num AugAssignAdd NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AugAssignAdd NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AugAssignAdd NameStore TupleLoad NameLoad NameLoad NameLoad Return NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Expr Str Assign NameStore ListLoad CompareIs NameLoad NameLoad CompareIs NameLoad NameLoad CompareIs NameLoad NameLoad If Call NameLoad NameLoad body If UnaryOpNot Call NameLoad NameLoad body Raise Call NameLoad Str Return Call Call NameLoad NameLoad NameLoad NameLoad orelse Return Call Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list
N/A N/A numpy chainer cuda chainer function chainer.utils array chainer.utils type_check BilinearFunction N/A N/A function Function N/A check_type_forward N/A N/A self in_types N/A N/A N/A n_in N/A N/A N/A N/A in_types size eval N/A N/A N/A n_in 3 N/A n_in 6 N/A N/A N/A N/A type_check InvalidType N/A %s or %s N/A N/A N/A N/A in_types size 3 N/A N/A N/A in_types size 6 N/A %s == %s N/A N/A N/A in_types size n_in N/A N/A e1_type e2_type W_type N/A in_types N/A 3 N/A type_check_prod N/A N/A type_check Variable N/A numpy prod prod N/A N/A N/A type_check expect N/A N/A e1_type dtype N/A numpy float32 N/A N/A e1_type ndim 2 N/A N/A e2_type dtype N/A numpy float32 N/A N/A e2_type ndim 2 N/A N/A N/A e1_type shape N/A 0 N/A N/A e2_type shape N/A 0 N/A N/A W_type dtype N/A numpy float32 N/A N/A W_type ndim 3 N/A N/A type_check_prod N/A N/A e1_type shape N/A 1 N/A N/A W_type shape N/A 0 N/A N/A type_check_prod N/A N/A e2_type shape N/A 1 N/A N/A W_type shape N/A 1 N/A N/A n_in 6 N/A N/A out_size N/A N/A W_type shape N/A 2 N/A N/A V1_type V2_type b_type N/A in_types N/A 3 N/A N/A N/A type_check expect N/A N/A V1_type dtype N/A numpy float32 N/A N/A V1_type ndim 2 N/A N/A N/A V1_type shape N/A 0 N/A N/A W_type shape N/A 0 N/A N/A N/A V1_type shape N/A 1 out_size N/A N/A V2_type dtype N/A numpy float32 N/A N/A V2_type ndim 2 N/A N/A N/A V2_type shape N/A 0 N/A N/A W_type shape N/A 1 N/A N/A N/A V2_type shape N/A 1 out_size N/A N/A b_type dtype N/A numpy float32 N/A N/A b_type ndim 1 N/A N/A N/A b_type shape N/A 0 out_size N/A forward N/A N/A self inputs N/A N/A N/A e1 N/A N/A array as_mat N/A inputs N/A 0 N/A e2 N/A N/A array as_mat N/A inputs N/A 1 N/A W N/A inputs N/A 2 N/A xp N/A N/A cuda get_array_module inputs N/A N/A xp numpy N/A N/A y N/A N/A numpy einsum ij,ik,jkl->il e1 e2 W N/A N/A N/A i_len j_len N/A e1 shape N/A k_len N/A N/A e2 shape N/A 1 N/A e1e2 N/A N/A e1 N/A N/A N/A N/A None N/A e2 N/A N/A N/A None N/A N/A e1e2 N/A N/A e1e2 reshape i_len N/A j_len k_len N/A W_mat N/A N/A W reshape -1 N/A N/A W shape N/A 2 N/A y N/A N/A e1e2 dot W_mat N/A N/A N/A len inputs 6 N/A N/A N/A V1 V2 b N/A inputs N/A 3 N/A y N/A N/A e1 dot V1 N/A y N/A N/A e2 dot V2 N/A y b N/A N/A y N/A backward N/A N/A self inputs grad_outputs N/A N/A N/A e1 N/A N/A array as_mat N/A inputs N/A 0 N/A e2 N/A N/A array as_mat N/A inputs N/A 1 N/A W N/A inputs N/A 2 N/A gy N/A grad_outputs N/A 0 N/A xp N/A N/A cuda get_array_module inputs N/A N/A xp numpy N/A N/A gW N/A N/A numpy einsum ij,ik,il->jkl e1 e2 gy N/A ge1 N/A N/A numpy einsum ik,jkl,il->ij e2 W gy N/A ge2 N/A N/A numpy einsum ij,jkl,il->ik e1 W gy N/A N/A kern N/A N/A cuda reduce T in0, T in1, T in2 T out in0 * in1 * in2 a + b out = a 0 bilinear_product N/A e1_b N/A e1 N/A N/A N/A N/A None N/A None N/A e2_b N/A e2 N/A N/A N/A None N/A N/A None N/A gy_b N/A gy N/A N/A N/A None N/A None N/A N/A W_b N/A W N/A N/A None N/A N/A N/A N/A gW N/A kern e1_b e2_b gy_b axis 0 N/A ge1 N/A kern e2_b W_b gy_b axis N/A 2 3 N/A ge2 N/A kern e1_b W_b gy_b axis N/A 1 3 N/A ret N/A N/A N/A ge1 reshape N/A N/A inputs N/A 0 shape N/A N/A ge2 reshape N/A N/A inputs N/A 1 shape gW N/A N/A N/A len inputs 6 N/A N/A N/A V1 V2 b N/A inputs N/A 3 N/A gV1 N/A N/A N/A e1 T dot gy N/A gV2 N/A N/A N/A e2 T dot gy N/A gb N/A N/A gy sum 0 N/A ge1 N/A N/A gy dot N/A V1 T N/A ge2 N/A N/A gy dot N/A V2 T N/A ret N/A gV1 gV2 gb N/A ret N/A N/A bilinear N/A N/A e1 e2 W V1 V2 b N/A None None None N/A N/A Applies a bilinear function based on given parameters.

    This is a building block of Neural Tensor Network (see the reference paper
    below). It takes two input variables and one or four parameters, and
    outputs one variable.

    To be precise, denote six input arrays mathematically by
    :math:`e^1\in \mathbb{R}^{I\cdot J}`,
    :math:`e^2\in \mathbb{R}^{I\cdot K}`,
    :math:`W\in \mathbb{R}^{J \cdot K \cdot L}`,
    :math:`V^1\in \mathbb{R}^{J \cdot L}`,
    :math:`V^2\in \mathbb{R}^{K \cdot L}`, and
    :math:`b\in \mathbb{R}^{L}`,
    where :math:`I` is mini-batch size.
    In this document, we call :math:`V^1`, :math:`V^2`, and :math:`b` linear
    parameters.

    The output of forward propagation is calculated as

    .. math::

      y_{il} = \sum_{jk} e^1_{ij} e^2_{ik} W_{jkl} + \
        \sum_{j} e^1_{ij} V^1_{jl} + \sum_{k} e^2_{ik} V^2_{kl} + b_{l}.

    Note that V1, V2, b are optional. If these are not given, then this
    function omits the last three terms in the above equation.

    .. note::

       This function accepts an input variable ``e1`` or ``e2`` of a non-matrix
       array. In this case, the leading dimension is treated as the batch
       dimension, and the other dimensions are reduced to one dimension.

    .. note::

       In the original paper, :math:`J` and :math:`K`
       must be equal and the author denotes :math:`[V^1 V^2]`
       (concatenation of matrices) by :math:`V`.

    Args:
        e1 (~chainer.Variable): Left input variable.
        e2 (~chainer.Variable): Right input variable.
        W (~chainer.Variable): Quadratic weight variable.
        V1 (~chainer.Variable): Left coefficient variable.
        V2 (~chainer.Variable): Right coefficient variable.
        b (~chainer.Variable): Bias variable.

    Returns:
        ~chainer.Variable: Output variable.

    See:
        `Reasoning With Neural Tensor Networks for Knowledge Base Completion
        <http://papers.nips.cc/paper/5028-reasoning-with-neural-tensor-
        networks-for-knowledge-base-completion>`_ [Socher+, NIPS2013].

     N/A flags N/A N/A V1 None N/A V2 None N/A b None N/A N/A any flags N/A N/A N/A N/A all flags N/A N/A N/A ValueError All coefficients and bias for bilinear() must be None, if at least one of them is None. N/A N/A N/A BilinearFunction e1 e2 W N/A N/A N/A N/A BilinearFunction e1 e2 W V1 V2 b N/A