When dim=100, it fails on matmul and we get the cublas error. When dim=1000, it fails on the inversion step, and we get the singular U error.
Reverting to a previous version of pytorch fixes the errors, which we can do in Colab with:
!pip install torch==1.0.0 torchvision==0.2.1