I was using the below code and it worked with pytorch 0.4.1.
Suddenly, with the new Pytorch installation it is giving error. I have a large codebase and don’t want to change APIs. Any quick way to solve this? Thank you for your help.
logpt = logpt.gather(1, target)
RuntimeError: Invalid index in gather at /opt/conda/conda-bld/pytorch_1549628766161/work/aten/src/TH/generic/THTensorEvenMoreMath.cpp:457
Could you post the shape of logpt and the min and max values of target?
If the index is wrong it should also be caught in 0.4.1. I’m wondering if the creation of target changed in some way.
Thanks for the information. The max value should be 299 and is apparently a bit higher.
Could you check how target was calculated and see where this high value comes from?