As the error describes, you would have to transfer the CUDATensor to the CPU first, since numpy cannot use GPU tensors.
Assuming this line of code raises the issue:
np_top_labs = top_labs[0].numpy()

use this instead:
np_top_labs = top_labs[0].cpu().numpy()

(and .detach(), if necessary).