pytorch-relation-extraction icon indicating copy to clipboard operation
pytorch-relation-extraction copied to clipboard

IndexError: too many indices for array

Open joy19952019 opened this issue 4 years ago • 5 comments

您好,在运行main_mil时出现上述报错,请问该如何解决? 图片

joy19952019 avatar Aug 20 '20 16:08 joy19952019

报错位置: File "main_mil.py", line 136, in select_instance max_ins_id = max_ins_id.data.numpy()[0] IndexError: too many indices for array

joy19952019 avatar Aug 20 '20 16:08 joy19952019

你好 请检查下python的版本,或者输出下 max_ins_id.data.size()

ShomyLiu avatar Aug 22 '20 00:08 ShomyLiu

感谢回复!我的python版本是3.7.6。max_ins_id.data.size()输出结果是torch.Size([])。看起来没有输出结果,那么问题是在这行里吗? max_ins_id = torch.max(out[:, label], 0)[1]

joy19952019 avatar Aug 24 '20 11:08 joy19952019

你好,这里建议手动debug下? 您这个问题我这里无法复现哈

ShomyLiu avatar Aug 29 '20 07:08 ShomyLiu

我也有这个错误,请问您解决了吗?

maxuejie514 avatar May 20 '21 08:05 maxuejie514