TypeError: only integer scalar arrays can be converted to a scalar index

后端 未结 3 1410
春和景丽
春和景丽 2020-12-30 02:17

I am trying a simple demo code of tensorflow from github link.
I\'m currently using python version 3.5.2

Z:\\downloads\\tensorflow_demo-master\\         


        
3条回答
  •  暖寄归人
    2020-12-30 03:01

    you can modify the function:

    def _read32(bytestream):
        dt = numpy.dtype(numpy.uint32).newbyteorder('>')
        return numpy.frombuffer(bytestream.read(4), dtype=dt)
    

    new version:

    def _read32(bytestream):
        dt = numpy.dtype(numpy.uint32).newbyteorder('>')
        return numpy.frombuffer(bytestream.read(4), dtype=dt)[0]
    

    add [0] in the end.

    This appears to be an issue with the latest version of Numpy. A recent change made it an error to treat a single-element array as a scalar for the purposes of indexing.

提交回复
热议问题