Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed bug of cuda cpu mismatch #319

Merged
merged 1 commit into from
May 11, 2021
Merged

fixed bug of cuda cpu mismatch #319

merged 1 commit into from
May 11, 2021

Conversation

ekomurcu
Copy link
Contributor

Hi,

When I called dense() function to convert sparse tensor back to dense tensor, I got this error:
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

I think the problem comes from the local variable of tensor_stride which should be initialised at the device that is being used.
After changing these two lines, I could train my network. Hope this helps.

Best

@ethanweber
Copy link

I have a similar issue with calling .sparse() with RuntimeError: ... assertion (at::cuda::check_device({rows, cols, mat2})) failed. All inputs must be on the same device. This is occurring in MinkowskiTensorField.py at this line. Thanks.

@chrischoy chrischoy added the bug Something isn't working label May 7, 2021
@chrischoy chrischoy merged commit a445cf6 into NVIDIA:master May 11, 2021
@loiccordone
Copy link

Hello, the error still occurs when a min_coordinate is passed as a parameter.
It must be of type "torch.IntTensor" due to the first assert.

Adding min_coordinate = min_coordinate.to(self.device) line 512 after the else: fix the problem for the 'dense' function.

Tanazzah pushed a commit to Tanazzah/MinkowskiEngine that referenced this pull request Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants