Thank you, it cleared a lot of things out. The dim I was using in F.log_softmax was -1.
If  you don’t mind me asking another stupid question I’ve noticed that torch.topk() with k=1 actually works like torch.max() on a 2-dim x input over the dim=1. Am I correct in assuming that? When I first saw torch.topk() with k=1 it confused me a lot as I was expecting the result to be just one value returned, and that would be the first top result?