Bick95:

PyTorch’s official website on loss functions, examples are provided where both so called inputs and target values are provided to a loss function. I assume, that the input tensor models the output of a network, such that loss functions compute the loss as a function of the difference between the target and the input values.


That 's correct. I agree that the naming your “prediction” input is somewhat misleading. I personally use prediction = model(data) output = loss(prediction, target) output.backward()
to train my models.



 Bick95:

Could I simply pass a batch of inputs through the network, get a batch of q-values returned, and then pass both the batch of predicted q_values and the batch of target_values to the loss function? Is that how easy it works?


I’m currently working on PPO stuff and I don’t claim to be an expert on Q learning but I think the problem is that the exploration is fundamentally serial because you look for the most promising action to take for a given state and a given approximation of the Q-Value so where you end up next is dependent on that. What you could do though is running multiple processes in which you use your Q-network to fill a joint buffer. Once the buffer is full you can use batches to update your Q-Network.
I hope this helps