I have a for loop in which the first iteration is substantially faster than subsequent iterations. This discrepancy only appears when I use a GPU. On a CPU every iteration takes more or less the same time. I’m wondering what causes this and whether there’s anything I can do to prevent the slow down in later iterations.
The code is here. https://colab.research.google.com/drive/1TC6khI8T44KcYCrdAkHpldw_ejRG_eO2?usp=sharing
Apologies if this is a common question or there’s a simple explanation, but I haven’t been able to find any answers.