折腾了一上午,看到别人写的博客没办法解决我的问题。忽然想到灵感。

我要做的是,测试一下我自己写的数据是否可以通过网络输出。但只有一个批量。

他会报如下错误

pytorch中遇到Expected more than 1 value per channel when training, got input size torch.Size([1, 128, 1, 1])解决方法。

 

 这里只需要把model状态改成eval()模式就可以了,因为在train()状态下是进行批量训练的。

改之后的代码为

pytorch中遇到Expected more than 1 value per channel when training, got input size torch.Size([1, 128, 1, 1])解决方法。

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2021-07-31
  • 2022-12-23
  • 2021-12-18
  • 2021-08-12
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-05
  • 2022-12-23
  • 2022-03-01
  • 2022-12-23
  • 2021-12-27
相关资源
相似解决方案