def METHOD_NAME(self, x1, batch1, x2, batch2):
    results1, results2 = [], []
    for i in range(batch1[-1] + 1):
        x, y = x1[batch1 == i, :], x2[batch2 == i, :]
        att_scores = torch.mm(x, torch.transpose(y, 1, 0))
        attention_x = torch.mm(torch.softmax(att_scores, dim=1), y)
        attention_y = torch.mm(torch.transpose(torch.softmax(att_scores, dim=0), 1, 0), x)
        results1.append(attention_x)
        results2.append(attention_y)
    attentions1 = x1 - torch.cat(results1, dim=0)
    attentions2 = x2 - torch.cat(results2, dim=0)
    return attentions1, attentions2