ShusenTang / Dive-into-DL-PyTorch

本项目将《动手学深度学习》(Dive into Deep Learning)原书中的MXNet实现改为PyTorch实现。
http://tangshusen.me/Dive-into-DL-PyTorch
Apache License 2.0
18.17k stars 5.38k forks source link

函数get_fashion_mnist_labels(labels)调用时报错 #125

Open ghost opened 4 years ago

ghost commented 4 years ago

bug描述 def get_fashion_mnist_labels(labels): text_labels = ['t-shirt', 'trouser', 'pullover', 'dress', 'coat', 'sandal', 'shirt', 'sneaker', 'bag', 'ankle boot'] return [text_labels[int(i)] for i in labels]


TypeError Traceback (most recent call last)

in ----> 1 get_fashion_mnist_labels(8) in get_fashion_mnist_labels(labels) 2 text_labels = ['t-shirt', 'trouser', 'pullover', 'dress', 'coat', 3 'sandal', 'shirt', 'sneaker', 'bag', 'ankle boot'] ----> 4 return [text_labels[int(i)] for i in labels] TypeError: 'int' object is not iterable