import torch
from d2l import torch as d2l
from torch.utils import data
import matplotlib.pyplot as plt
import torchvision
from torchvision import transforms
def get_fashion_mnist_labels(labels):
"""返回Fashion-MNIST数据集的⽂本标签。这里做了数字到字符串映射"""
text_labels = ['t-shirt', 'trouser', 'pullover', 'dress', 'coat', 'sandal', 'shirt','sneaker', 'bag', 'ankle boot']
return [text_labels[int(i)] for i in labels]
#img 表示要描画的图像数据,row&cols 分别表示要画面几行几列,scale表示缩放比例
def show_images(imgs, num_rows, num_cols, titles=None, scale=1.5):
"""Plot a list of images."""
figsize = (num_cols * scale, num_rows * scale)
_, axes = d2l.plt.subplot