Thank you. I stumbled into another problem: my fresh installation of pytorch lacks ATen/native/cuda folder, which contains headers with gpu_kernel function used together with TensorIterator in the example you provided. I installed pytorch via conda install -c pytorch pytorch torchvision --cudatoolkit=10.2.