Dear ptrblck,
Thank you for your reply.

If you are using an older PyTorch version, please update to the latest stable, since indexing errors should raise RuntimeErrors, not fail with illegal memory accesses.

I’ve tried to update pytorch to the last version but I encountered difficulties. I tried several things:

First of all I updated  my cudatoolkit from 10.0 to 10.2
Then I ran the command : conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
Nothing happened (I kept my old version of pytorch - 1.7.1)
Then I tried :  pip install --upgrade torch torchvision torchaudio
Here pytorch was updated to 1.8.1 but I could not launch my code on jupyter notebook because the kernel crashed at the very beginning when importing packages.
Then I decided to remove pytorch entirely and install it back. I ran the following lines :

conda uninstall pytorch
pip uninstall torch
pip uninstall torch
conda uninstall torchvision
pip uninstall torchvision
pip uninstall torchvision
conda uninstall torchaudio
pip uninstall torchaudio
pip uninstall torchaudio
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch


But the version I got back was the previous one (1.7.1)

Then I wanted to force pytorch to update to 1.8.1. So I ran conda install pytorch=1.8.1 torchvision torchaudio cudatoolkit=10.2 -c pytorch
But I got several package conflicts (openssl, mkl_fft, python_abi, msgpack-python, m2w64-gcc-libs, tornado, vs2008_runtime, libssh2, prompt_toolkit, vs2015_runtime, clyent, pywin32, sqlite, blas, statsmodels, ibllvm9, jupyter_client, babel, zipp, libpng, hypothesis, ipython, xz, configparser, enum34, traitlets, sphinx, numpy, nbformat, jpeg, contextlib2, pycrypto, python-simplegeneric, matplotlib-inline, liblapacke, jupyterlab_widgets, snowballstemmer, backcall, urllib3, ipython_genutils, jupyterlab_server, notebook, rtree, pysocks, qtconsole, bkcharts, conda, pyopenss, toolz, matplotlib-base, html5lib, mkl-service, zlib, spyder-kernels, imagesize, qtawesome, pandocfilters, ptyprocess, python-language-server, jedi, anaconda-project, … ).
I am using python 3.8.3 and anaconda 4.10.1

Could you help me with this?