Checkout your pytorch version. This link might be helpful - Errors and corrections in 005_dogs_cats.ipynb