technically, following may work
d = out[:,0]-out[:,1]
loss = (d.abs() * torch.heaviside(d, torch.zeros(1))).mean()

but it still may be difficult to optimize with this formulation, as gradients are discrete in (-1,0,1). Adam + lr scheduler may get you somewhere, if not, reformulate your loss with d**2 and constraints/penalties somehow.