【问题标题】:AttributeError: 'float' object has no attribute 'pop' in Custom Keras Model with overwritten train_stepAttributeError:“float”对象在自定义 Keras 模型中没有属性“pop”,并覆盖 train_step
【发布时间】:2020-09-12 03:04:00
【问题描述】:

我收到此错误 AttributeError: 'float' object has no attribute 'pop' in my Encoder-Decoder custom Keras model while using model.fit with custom train_step.我不明白这个错误发生在哪里。当我们不知道错误的位置时,我需要有关如何解决此类错误的帮助?

Epoch 1/10
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-561-573fadf7e010> in <module>()
----> 1 model.fit(dataset,epochs=10)

5 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/callbacks.py in _batch_update_progbar(self, logs)
    921 
    922     logs = copy.copy(logs) if logs else {}
--> 923     batch_size = logs.pop('size', 0)
    924     num_steps = logs.pop('num_steps', 1)  # DistStrat can run >1 steps.
    925     logs.pop('batch', None)

AttributeError: 'float' object has no attribute 'pop'

链接到我的代码:https://github.com/abhishek203/E-Abhishek/blob/master/Untitled4.ipynb

【问题讨论】:

    标签: python keras tensorflow2.0 tf.keras


    【解决方案1】:

    您的训练步骤的返回语句应该类似于 {'loss':loss} 而不是 loss

    【讨论】:

      猜你喜欢
      • 2019-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-02
      • 2016-04-15
      • 2020-01-11
      • 1970-01-01
      • 2022-09-22
      相关资源
      最近更新 更多