Hey, as the Title alraedy states, im getting a ‘PowBackward0’ error. Ive looked through the other discussions here, but cant find the issue.
def contrastiveloss(self, x1, x2, y):
    diff = abs(x1 - x2)
    dist = torch.sum(torch.pow(diff, 2), 1)
    euclidian_dist = torch.sqrt(dist)
    pos = y * euclidian_dist

    #negative pair
    margin = self.hparams['margin_loss']**2
    max = torch.clamp(margin-euclidian_dist, min=0)
    neg = (1-y)*max

    loss = pos + neg
    loss = torch.sum(loss) / 2.0 / x1.size()[0]  # since data is in batches, we need to average them
    return loss

I dont see where in this code anything can go wrong, I already made the diff variable absolute.