SQLNet
SQLNet copied to clipboard
IndexError: too many indices for array
Hi,
I got the following error while training. (python train.py --ca)
i guess in utils.py line 145
loss.data.cpu().numpy() is an empty array
can you please let us know how to resolve this issue.
can you tell me how did you solve the error?
just use pytorch with version under 0.4
In PyTorch >=0.4. The return value of cpu() has been changed to 0-dimensional. So just modify the following line will fix this issue.
cum_loss += loss.data.cpu().numpy()[0]*(ed - st)
Change to
cum_loss += loss.data.cpu().numpy()*(ed - st)
thanks tom. your solution is working :-)