## CIN的数学原理

https://daiwk.github.io/posts/dl-dl-ctr-models.html#cin

## pytorch的实现

https://pytorch.org/docs/stable/torch.html?highlight=einsum#torch.einsum

torch.einsum(equation, *operands) → Tensor[SOURCE]

This function provides a way of computing multilinear expressions (i.e. sums of products) using the Einstein summation convention.

• Parameters

equation (string) – The equation is given in terms of lower case letters (indices) to be associated with each dimension of the operands and result. The left hand side lists the operands dimensions, separated by commas. There should be one index letter per tensor dimension. The right hand side follows after -> and gives the indices for the output. If the -> and right hand side are omitted, it implicitly defined as the alphabetically sorted list of all indices appearing exactly once in the left hand side. The indices not apprearing in the output are summed over after multiplying the operands entries. If an index appears several times for the same operand, a diagonal is taken. Ellipses … represent a fixed number of dimensions. If the right hand side is inferred, the ellipsis dimensions are at the beginning of the output.operands (Tensor) – The operands to compute the Einstein sum of.