Yes, I think I at least now know what is causing this, though the error seems misleading.
I train a model (GAN) with a batch size larger than 4, I get this error. Unless I hard reset (factory reset the runtime), even after restarting the kernel and clearing all caches will cause anything related with the GPU to output this error.
It’s not just the code above, just using .to(‘cuda’) will suffice.
It’s funky, but I’m also just really learning pytorch now.
Maybe it’s because I keep the image arrays in memory (about 700 MB total) instead of loading each image in in batches?