微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

gtensorflow-gpu中model.fit的问题

如何解决gtensorflow-gpu中model.fit的问题

错误是在 google-colab 上报告的。我的代码运行良好。然后我重新启动运行时,并重新运行它给出了以下错误

RuntimeError: Detected a call to `Model.fit` inside a `tf.function`. `Model.fit is a high-level endpoint that manages its own `tf.function`. Please move the call to `Model.fit` outside of all enclosing `tf.function`s. Note that you can call a `Model` directly on `Tensor`s inside a `tf.function` like: `model(x)`.

好吧,我在使用 model.predict 时遇到了类似的问题,并使用 model(x) 修复了它,但是在使用 model.fit 时如何处理它。

更新:问题已修复,我重新启动了运行时,现在已修复。但无法解释到底发生了什么。在 colab 上做了很多工作,从未遇到过类似的事情。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。