Sorting is not differentiable. You can do the following trick:
y1, y2 = model(x)
y2 = torch.logsumexp([y1, y2])

Since LogSumExp is smooth maximum, y2 will also be greater than y1 (see https://en.wikipedia.org/wiki/Smooth_maximum 8).
Then apply sigmoid or any other non-decreasing function that transforms input to (0, 1) range.