Loss.backward() raises error 'grad can be implicitly created only for scalar outputs'

Let’s continue the discussion in the topic you’ve created and have a look at @SimonW’s answer.