TypeError: len is not well defined for symbolic Tensors. (activation_3/Identity:0) Please call `x.shape` rather than `len(x)` for shape information

后端 未结 1 1436
遇见更好的自我
遇见更好的自我 2021-01-17 09:47

I am trying to implement a DQL model on one game of openAI gym. But it\'s giving me following error.

TypeError: len is not well defined for symbolic T

相关标签:
1条回答
  • 2021-01-17 10:28

    The reason this breaks is because, tf.Tensor TF 2.0.0 (and TF 1.15) has the __len__ overloaded and raises an exception. But TF 1.14 for example doesn't have the __len__ attribute.

    Therefore, anything TF 1.15+ (inclusive) breaks keras-rl (specifically here), which gives you the above error. So you got two options,

    • Downgrade to TF 1.14 (recommended)
    • Delete the __len__ overloading in TensorFlow source (not recommended as this can break other things)
    0 讨论(0)
提交回复
热议问题