I want to calculate the top k accuracy using the sklearn implementation:I was wondring if using this is correct

output = model(data)

target_top_numpy=target.cpu().detach().numpy()

predicted_top_numpy=output.cpu().detach().numpy()

top2=top2+top_k_accuracy_score(target_top_numpy, predicted_top_numpy, k=2,normalize=False,labels=range(11))

my question much more precisly should I apply softmax function on the output before fiding it to the top k score function or it is working fine this way?