首页 > 解决方案 > TypeError:无法将符号 Keras 输入/输出转换为 google colab 上的 numpy 数组

问题描述

我正在尝试使用 google colab运行此代码文件。虽然我得到了一些输出,但出现了一个错误,我不太明白为什么会出现这个错误。

TypeError: Cannot convert a symbolic Keras input/output to a NumPy array. This error may indicate that you're trying to pass a symbolic value to a NumPy call, which is not supported. Or, you may be trying to pass Keras symbolic inputs/outputs to a TF API that does not register dispatching, preventing Keras from automatically converting the API call to a lambda layer in the Functional Model.

我在堆栈溢出时查看了这个问题,发现其他用户之前发布的几个相同的问题,但我认为我没有找到任何与我的代码相关的答案。请帮助我了解代码有什么问题以及如何解决?我对 TensorFlow 完全陌生。

注意:我会在这里粘贴整个代码,但它是一个超过 1400 行的代码,所以我直接超链接了文件,因为人们可能会生气,此外,这样做会变得很长。但如果需要,我可以编辑帖子并将整个代码粘贴到此处。

标签: pythontensorflowdeep-learningtypeerrorgoogle-colaboratory

解决方案


推荐阅读