知乎专栏 |
抛出异常如下
Traceback (most recent call last): File "/Users/neo/PycharmProjects/netkiller/test/cifar10.py", line 150, in <module> main() File "/Users/neo/PycharmProjects/netkiller/test/cifar10.py", line 47, in main images, labels = dataiter.next() ^^^^^^^^^^^^^ AttributeError: '_MultiProcessingDataLoaderIter' object has no attribute 'next'
出现问题的代码行
images, labels = dataiter.next()
解决方案,修改如下:
# 将 images, labels = dataiter.next() # 修改为 images, labels = next(dataiter)