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]
 
posted @ 2018-10-13 17:48  LuffysMan  阅读(574)  评论(0编辑  收藏  举报