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:
- How to Solve Error: RuntimeError: all tensors must be on devices[0]
- [Solved] Runtimeerror during dcgan training: found dtype long but expected float
- [Solved] RuntimeError: 1only batches of spatial targets supported (non-empty 3D tensors) but got targets of s
- Error in Tensorflow using variables: List of Tensors when single Tensor expected
- TensorFlow issue: Expected int32, got list containing Tensors of type ‘_Message’ instead.
- error: expected ‘;‘ at end of member declaration and expected ‘)‘ before ‘&‘ toke Errors
- Run real machine Errors were encountered while preparing your device for development. Please check the Devices
- [Solved] RuntimeError: CUDA error: invalid device ordinal
- Libtorch Error: Expected object of type Variable but found type CUDALongType for argument #2 ‘index’
- RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future rel
- [Solved] Bringing up interface eth0: Error: No suitable device found: no device found for connection ‘System eth0’.
- [Solved] Runtimeerror: CUDA error: device side assert triggered
- [Solved] adb Error: error: no devices/emulators found error: cannot connect to daemon
- [Solved] Cmake compile opencv open-source project Error: but it set OpenCV_FOUND to FALSE so package “OpenCV” is considered to be…
- [Solved] torch Do Targer Detection Error: RuntimeError: CUDA error: device-side assert triggered
- [Solved] swiper Error: The requested module ‘react’ is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export
- TensorFlow-gpu Error: failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
- Audit reported an error: “the device settings could not be applied because of the following error: Mme device internal error“
- Arrays must all be same length [How to Solve]
- [Solved] Springboot WARNING: All illegal access operations will be denied in a future release