def forward(self, batch):
    U = self.user_embedding(batch[self.fuid])
    S = self.item_encoder(batch[('in_' + self.fiid)])
    S_F = (S * torch.sigmoid(((self.W_g_1(S) + self.W_g_2(U).view(U.size(0), 1, (- 1))) + self.b_g)))
    weight = torch.sigmoid((self.w_g_3(S_F) + ((example @ example.com(0)), (- 1), 1)))
    S_I = (S_F * weight)
    if (self.pooling_type == 'mean'):
        s = (S_I.sum(1) / weight.sum(1))
    elif (self.pooling_type == 'max'):
        s = torch.max(S_I, dim=1).values
    else:
        raise ValueError('`pooling_type` only support `avg` and `max`')
    query = ((U + s) + S.sum(1))
    return query
def forward(self, batch):
    U = self.user_embedding(batch[self.fuid])
    S = self.item_encoder(batch[('in_' + self.fiid)])
    S_F = (S * torch.sigmoid(((self.W_g_1(S) + self.W_g_2(U).view(U.size(0), 1, (- 1))) + self.b_g)))
    weight = torch.sigmoid((self.w_g_3(S_F) + ((example @ example.com(0)), (- 1), 1)))
    S_I = (S_F * weight)
    if (self.pooling_type == 'mean'):
        s = (S_I.sum(1) / weight.sum(1))
    elif (self.pooling_type == 'max'):
        s = torch.max(S_I, dim=1).values
    else:
        raise ValueError('`pooling_type` only support `avg` and `max`')
    query = ((U + s) + S.sum(1))
    return query