Oh, I’m sorry, I seem to have misunderstood what you meant (asked about) earlier.
The first time I run it with a batch_size > 4 gives me this error:
RuntimeError: CUDA error: an illegal memory access was encountered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

It stays the same for all gpu related calls unless factory reset in colab even when restarting the kernel.