I am new to Pytorch so pardon if the question sounds stupid.
I am trying to do some sort of reinforcement learning similar to “http://karpathy.github.io/2016/05/31/rl/ 1”.
An agent needs to choose either “up” or “down” based on the inputs. As mentioned in the link, uppon winning the game, I assign “1” and “0” as errors to “up” and “down”, respectively, otherwise, “0” and “-1”, and backpropagate the error.
The problem is, in all pytorch c++ examples, i just see that the mean or sum of the errors (loss) is backpropagated. So my question is, how can I backpropagate for each loss defined for each output item?