Tag Archives: Code problem

[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!

[unity problem] what should I do if I encounter ‘Global::’ already contains a definition

Cs (7,14): error CS0101: The namespace ‘global::’ already contains a definition for’ LHtest’

Let’s first see if the code is okay. If you close UNITY,VS. Open it again, no effect.

So just copy and paste the entire correct code into another new.cs file. I’m going to run this new.cs file.

Then the problem is solved.

In another case, you create a.cs file with the same name, just change the name.