#89·pulse

What is the usage of geocross loss?

Author: yvoonne06Created Feb 7, 2023Updated Aug 28, 2023

I wonder how the geocross loss works to find the direction of updating the latent vector.

def _loss_geocross(self, latent, **kwargs):
    if(latent.shape[1] == 1):
        return 0
    else:
        X = latent.view(-1, 1, 18, 512)
        Y = latent.view(-1, 18, 1, 512)
        A = ((X-Y).pow(2).sum(-1)+1e-9).sqrt()
        B = ((X+Y).pow(2).sum(-1)+1e-9).sqrt()
        D = 2*torch.atan2(A, B)
        D = ((D.pow(2)*512).mean((1, 2))/8.).sum()
        return D