2021-11-12

深度学习“NumpyArrayIterator” object has no attribute 'shape’报错解决办法

问题描述:

在进行深度学习训练时,出现“NumpyArrayIterator” object has no attribute 'shape’的报错

原因分析:

修改…\Python\Python36\Lib\site-packages\tensorflow_core\python\keras\engine\training_generator.py
(这里按照自己的报错路径)

在num_samples = int(nest.flatten(data)[0].shape[0])前添加代码返回generator

解决方案:

is_sequence = isinstance(data, data_utils.Sequence)
if not is_sequence:
    return data, steps_per_epoch
# Create generator from NumPy or EagerTensor Input.
num_samples = int(nest.flatten(data)[0].shape[0])
上一篇:Mybatis逆向工程


下一篇: