Hi, I’m doing some calculations using numba cuda and was wondering if I could just wrap the cuda array with a FloatTensor and Variable instead of copying it to the host using numba and back to device with pytorch.
Let’s say I do:
from numba import cuda
import numpy as np
x = cuda.device_array((3, 9, 11), dtype=np.float32)

How can I wrap this array with pytorch?
I am able to get the ctypes pointer of the array with x.device_ctypes_pointer but I don’t know how to proceed from there to pass it to a torch.cuda.FloatTensor
As far as I can tell, this code here does the opposite: https://gist.github.com/t-vi/2f4fe23a5b473b9dceb95b163378b4d5#file-pytorch-numba-py-L49-L54 42