You would get approx. the same results assuming your indexing is right (I had to use [torch.arange(y.size(0), y] if y has the shape [batch_size]).
However, you might run into numerical stability issues, as you are applying torch.log and F.softmax separately.
You could try to use loss = -F.log_softmax(logits, dim=1)[torch.arange(y.size(0)), y] instead and compare your results with the unreduced reference loss.