人工智能
18791985373
这个作者很懒,什么都没留下…
展开
-
关于RuntimeError: output with shape [1, 28, 28] doesn't match the broadcast shape [3, 28, 28]
RuntimeError: output with shape [1, 28, 28] doesn’t match the broadcast shape [3, 28, 28]在跑Pytroch的MNIST手写识别例子时,碰到了这个错误,报错位置代码如下transform = transforms.Compose([ transforms.ToTensor(), transforms....原创 2019-11-19 12:21:25 · 1764 阅读 · 1 评论 -
关于pytorch的invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python在学习神经网络训练MINIST数据集时Pycharm爆出这个问题,问题代码如下:train_loss+=loss.data[0]分析发现原因在于PyTorch0.3.1版本会使用这种写法,但在...原创 2019-11-19 11:32:11 · 351 阅读 · 0 评论