Pointcept / PointTransformerV3

[CVPR'24 Oral] Official repository of Point Transformer V3 (PTv3)
MIT License
824 stars 47 forks source link

viewing a tensor as a new dtype with a different number of bytes per element is not supported. #107

Open Levishery opened 3 weeks ago

Levishery commented 3 weeks ago

My PyTorch version is 1.10.0. On line 143 of the hilbert.py file, the code locs_uint8 = locs.long().view(torch.uint8).reshape((-1, num_dims, 8)).flip(-1) will report an error: viewing a tensor as a new dtype with a different number of bytes per element is not supported. I understand that switching to PyTorch 1.12.0 can solve this problem, but my CUDA version doesn't support me doing so. May I ask if there is an alternative solution for this line of code?

Levishery commented 3 weeks ago

Is torch.view(torch.uint8) do the same function as numpy.view(numpy.uint8)? Is changing the code to

    locs = locs.long()
    locs_uint8 = torch.tensor(np.asarray(locs).view(np.uint8))
    locs_uint8 = locs_uint8.reshape((-1, num_dims, 8)).flip(-1)

ok?

Gofinge commented 3 weeks ago

I think it would harm the performance with change tensor in CUDA to array in CPU. How about ask ChatGPT about the solution?