Torch: invalid memory size -- maybe an overflow? at /opt/conda/conda-bld/pytorch-nightly_1549065556721/work/aten/src/TH/THGeneral.cpp:188

Hi all,
After 2,3 epochs (sometimes before finishing first epoch also) my model gives the error, Torch: invalid memory size – maybe an overflow? at /opt/conda/conda-bld/pytorch-nightly_1549065556721/work/aten/src/TH/THGeneral.cpp:188. Can anyone help me to resolve this?. Pytorch version: 1.0.0.dev20190201 on Ubuntu 18.04.

Do you see the same error using the latest stable release (or latest nightly build)?

I did not update Pytorch. I will do the same and let you know the details.

I have updated Pytorch. Now I am getting another error in my data loader, RuntimeError: Trying to create tensor with negative dimension -2: [-2, 300].

Could you try to isolate which batch creates this issue or is it thrown in the first step of your DataLoader iteration?
You could iterate your Dataset and check, which index is raising this error.
Once you’ve isolated it, you could check what’s going wrong in the __getitem__ (or where this exception is raised).

Thanks. I resolved it. There was a small dimension error in my data loader.