Solved by SimonW in post #2 
              
              
                Your problem is not related to testing on cpu, but to that input is not contiguous. net.cpu() should be sufficient to pulling the network to CPU. There are two possibilities: 

Your X or Y is not contiguous yet the first operation of your net expect them to be. .cuda() makes a contiguous CUDA tensor…