问题
原因
troch版本问题造成。
解决方法
查看官方源码,改为新的写法。
原始的torch版本是1.0.0,官方源码写法如下:
def __getitem__(self, index):
"""
Args:
index (int): Index
Returns:
tuple: (image, target) where target is index of the target class.
"""