问题描述
限时送ChatGPT账号..我正在尝试学习 TensorFlow.目前,我正在使用占位符.当我尝试创建占位符时,出现错误:RuntimeError: tf.placeholder() is not compatible with Eager execution
,这是有道理的,因为占位符不能立即执行.
I am trying to learn TensorFlow. Currently, I am working with placeholders. When I tried to create the placeholder, I got an error: RuntimeError: tf.placeholder() is not compatible with eager execution
, which makes sense as placeholders are not executable immediately.
那么,如何关闭急切执行?
So, how do I turn eager execution off?
我从一开始就没有开启 Eager Execution,所以我不确定它是怎么发生的.有没有与 tf.disable_eager_execution()
相对的?
I have never turned eager execution on in the first place, so I am not sure how it happened. Is there an opposite to tf.disable_eager_execution()
?
推荐答案
假设您使用的是 Tensorflow 2.0 预览版,它默认启用了 Eager Execution.v1 API 中有一个 disable_eager_execution()
,你可以把它放在你的代码前面,比如:
Assume you are using Tensorflow 2.0 preview release which has eager execution enabled by default. There is a disable_eager_execution()
in v1 API, which you can put in the front of your code like:
import tensorflow as tf
tfpat.v1.disable_eager_execution()
另一方面,如果您没有使用 2.0 预览版,请检查您是否不小心在某处启用了 Eager Execution.
On the other hand, if you are not using 2.0 preview, please check if you accidentally enabled eager execution somewhere.
这篇关于如何禁用 TensorFlow 的急切执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论