IndexError:Dimension out of range(expected to be in range of [-1,0],but got 1)跑一个ocr的代码出现上述错误,解决方法:

1.设置batch_size和num_epochs能整除,即num_epochs/batch_size的值是一个正整数。
2.在DataLoader函数中,设置drop_last=True,如下图所示:
IndexError:Dimension out of range(expected to be in range of [-1,0],but got 1)

相关文章:

  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
猜你喜欢
  • 2022-12-23
  • 2021-07-29
  • 2021-09-26
  • 2022-01-14
  • 2021-06-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案