Solved by ptrblck in post #2 
              
              
                As the error message suggests, you would have to push the tensor to the CPU first before converting it to a numpy array via tensor.cpu(). 
In particular np.array(targets.argmax(1)) seems to raise the error to use: 
targets = targets.argmax(1).cpu().numpy()

instead. 
PS: you can post code snippets b…