I assume ps gives you the class probabilities (or logits), so topk will give you the highest class probabilities (logits) with the class indices for the current samples.
Since you are using .topk(k=1, dim=1), you’ll only get the single most likely prediction.