(self, x)
return result.squeeze(1)
:param x: Long tensor of size ``(batch_size, num_fields)``
:param x: Long tensor of size ``(batch_size, num_fields)``
: param x : Long tensor of size ( batch_size num_fields )
def forward(self, x):
        """
        :param x: Long tensor of size ``(batch_size, num_fields)``
        """
        emb, ad_emb = self.embedding(x)
        ad_emb = torch.cat([torch.mean(emb, 1, True), ad_emb], 1)
        fea = 0
        att = self.attention_layer(ad_emb.view(-1, self.ad_embed_dim))
        for i in range(len(self.mlp)):
            fea += (att[:, i].unsqueeze(1) * self.mlp[i](emb.view(-1, self.embed_output_dim)))
        result = 0

        att = self.output_attention_layer(ad_emb.view(-1, self.ad_embed_dim))
        for i in range(len(self.output_layer)):
            result += (att[:, i].unsqueeze(1) * torch.sigmoid(self.output_layer[i](fea)))
        return result.squeeze(1)
def forward ( self , x ) : emb , ad_emb = self . embedding ( x ) ad_emb = torch . cat ( [ torch . mean ( emb , 1 , True ) , ad_emb ] , 1 ) fea = 0 att = self . attention_layer ( ad_emb . view ( - 1 , self . ad_embed_dim ) ) for i in range ( len ( self . mlp ) ) : fea += ( att [ : , i ] . unsqueeze ( 1 ) * self . mlp [ i ] ( emb . view ( - 1 , self . embed_output_dim ) ) ) result = 0 att = self . output_attention_layer ( ad_emb . view ( - 1 , self . ad_embed_dim ) ) for i in range ( len ( self . output_layer ) ) : result += ( att [ : , i ] . unsqueeze ( 1 ) * torch . sigmoid ( self . output_layer [ i ] ( fea ) ) ) return result . squeeze ( 1 )