當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 計算一下合適的大小
當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 計算一下合適的大小
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。