Thanks again! Now I am getting this error: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
I am bit confused because as I see from my code all the labels etc are in cuda.
I added this command: output.cuda() to see if that was the problem but the error appears again.
Update: I made a function to return accuracy and pass output and labels to cpu and it works