AttributeError: 'tuple' object has no attribute 'reshape' 在读取mnist数据集时遇到的问题错误代码错误原因 在读取mnist数据集时遇到的问题 错误代码 temp = struct.unpack_from('>748B', buf, off)#从缓冲区按字节读取,每次读取size为28*28 img.append(np.reshape(temp, (28, 28))) 错误原因 tuple的原大小与reshape中参数不匹配(此处计算错误,28*28=784) 将748改为784即可