当batch里只有一个样本时,再调用batch_norm就会报下面这个错误:

 ValueError:Expected more than 1 value per channel when training, got input size torch.Size([1, 512, 1, 1])

在训练前用 num_of_samples % batch_size 计算一下合适的大小

相关文章:

  • 2022-12-23
  • 2021-05-31
  • 2021-12-30
  • 2021-10-21
  • 2021-10-29
  • 2021-12-16
  • 2021-12-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-05
  • 2022-12-23
  • 2021-07-31
  • 2022-12-23
  • 2022-01-02
相关资源
相似解决方案