tensorflow入门MNIST遇到的问题

解压.gz数据集文件时提示:TypeError: only integer scalar arrays can be converted to a scalar index

查阅资料后原创博主: https://blog.csdn.net/qq_29750461/article/details/82732469

原因在于 _read32(bytestream)这个函数

def _read32(bytestream):
#采用大尾端存储
dt = numpy.dtype(numpy.uint32).newbyteorder('>')
return numpy.frombuffer(bytestream.read(4), dtype=dt)[
改为即可:
def _read32(bytestream):
#采用大尾端存储
dt = numpy.dtype(numpy.uint32).newbyteorder('>')
return numpy.frombuffer(bytestream.read(4), dtype=dt)[0]
 

猜你喜欢

转载自www.cnblogs.com/LuffysMan/p/9783613.html
今日推荐