Thank you @tom This works like a charm for me, even without the explicit os.environ. Suggestion: @smth It would be great if PyTorch supported officially the conversion of a torch tensor to the DeviceNDArray (Numba gpu resident numpy array). It could be named: torch.Tensor.numba()  and would not require some complicated, not supported code, and would be done without the additional data movement from gpu to cpu and back to gpu.