Fix ConnectionError in download_mnist (#61789)
Summary:
Fixes issues like the following error. Note that `ConnectionResetError` is a subclass of `ConnectionError`.
```
+ python tools/download_mnist.py --quiet -d test/cpp/api/mnist
Downloading http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz ...
Traceback (most recent call last):
File "tools/download_mnist.py", line 93, in <module>
main()
File "tools/download_mnist.py", line 86, in main
download(path, resource, options.quiet)
File "tools/download_mnist.py", line 42, in download
urlretrieve(url, destination_path, reporthook=hook)
File "/opt/conda/lib/python3.6/urllib/request.py", line 277, in urlretrieve
block = fp.read(bs)
File "/opt/conda/lib/python3.6/http/client.py", line 463, in read
n = self.readinto(b)
File "/opt/conda/lib/python3.6/http/client.py", line 507, in readinto
n = self.fp.readinto(b)
File "/opt/conda/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/61789
Reviewed By: dreiss
Differential Revision: D29745459
Pulled By: zhouzhuojie
fbshipit-source-id: 2deb668bd74478f32bd01704d4362e8a4d95087b