I’m not @bzcheeseman, but I think I can elaborate.
The output of your network will have requires_grad because we need to backprop through it, but your targets should not have requires_grad because we don’t need to backprop through them. Since the first argument can require_grad but the second argument cannot, that means the output of the network should always come first.
In other words, this is ok:
loss(model_output, targets)

but this is not:
loss(targets, model_output)

EDIT: This is the opposite argument order of the functions in sklearn.metrics which makes it really annoying to write code that mixes both.