SQLNet icon indicating copy to clipboard operation
SQLNet copied to clipboard

IndexError: too many indices for array

Open dineshiitkgp opened this issue 6 years ago • 4 comments

Hi,

I got the following error while training. (python train.py --ca) error_sqlnet 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.

dineshiitkgp avatar Jul 24 '18 11:07 dineshiitkgp

can you tell me how did you solve the error?

littlerookie avatar Aug 20 '18 02:08 littlerookie

just use pytorch with version under 0.4

saxonelf avatar Aug 31 '18 11:08 saxonelf

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)

tomfat avatar Dec 04 '18 06:12 tomfat

thanks tom. your solution is working :-)

pprassu avatar Mar 02 '19 21:03 pprassu