解决tensor.sub_(mean).div_(std)RuntimeError: output with shape [1, 28, 28] doesn‘t match the broadcas


项目场景:

MNIST数据集 GANs生成



问题描述:

完整报错:

Traceback (most recent call last):
  File "pytorch_MNIST_cGAN.py", line 229, in <module>
    for x_, y_ in train_loader:
  File "/root/anaconda3/envs/dpm-pc-gen/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 521, in __next__
    data = self._next_data()
  File "/root/anaconda3/envs/dpm-pc-gen/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 561, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/root/anaconda3/envs/dpm-pc-gen/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/root/anaconda3/envs/dpm-pc-gen/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py
上一篇:查找文本文档中的关键字所在的句子,替换为空白


下一篇:Javascript中关于数组的认识