Based on the docs 3, the first argument should contain the log probabilities, while the second one the probabilities:

As with  NLLLoss , the input given is expected to contain  log-probabilities  and is not restricted to a 2D Tensor. The targets are given as  probabilities  (i.e. without taking the logarithm).

while Q and P seem to contain logits in your use case.