(self, x)
return 0.5 * ix
:param x: Float tensor of size ``(batch_size, num_fields, embed_dim)``
:param x: Float tensor of size ``(batch_size, num_fields, embed_dim)``
: param x : Float tensor of size ( batch_size num_fields embed_dim )
def forward(self, x):
        """
        :param x: Float tensor of size ``(batch_size, num_fields, embed_dim)``
        """
        square_of_sum = torch.sum(x, dim=1) ** 2
        sum_of_square = torch.sum(x ** 2, dim=1)
        ix = square_of_sum - sum_of_square
        if self.reduce_sum:
            ix = torch.sum(ix, dim=1, keepdim=True)
        return 0.5 * ix
def forward ( self , x ) : square_of_sum = torch . sum ( x , dim = 1 ) ** 2 sum_of_square = torch . sum ( x ** 2 , dim = 1 ) ix = square_of_sum - sum_of_square if self . reduce_sum : ix = torch . sum ( ix , dim = 1 , keepdim = True ) return 0.5 * ix