[Solved] RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and

RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking arugment for argument mat1 in method wrapper_addmm)
It says there are at least two devices, cup and cuda 0
Actually added a MLP, then tried to test it, and ended up reporting this error
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking arugment for argument mat1 in method wrapper_addmm)

Solution:
self.mlp1 = MLP(2048) # Example: This code added
Add this code followed by the following sentence.
self.mlp1.cuda()
Problem solved!

Read More: