I am trying to train a model to output the correct angle. I am currently restricting my outputs to [0, 2pi]:
2 * torch.pi * torch.sigmoid(logits)
My question is: What if the prediction is something like 1.9pi, but the target is 0.1pi. The loss should in theory be something like 0.2pi but in my current situation it will be 1.8pi.
I can not have a modular loss function since the angle is not the actual end product of my targets, but is rather an intermediate step towards computing the final output. Can a model instead output a modular value? I am afraid that performing logits % (2 * torch.pi) will lead to logits spinning out of control.