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

AttributeError:模块“tensorflow._api.v1.config”没有属性“run_functions_eagerly”

如何解决AttributeError:模块“tensorflow._api.v1.config”没有属性“run_functions_eagerly”

尝试在 Jupyter 中运行 ImageAI。 我收到以下错误

使用 TensorFlow 后端。

AttributeError Traceback(最近一次调用最后一次) 在 ----> 1 from imageai.Detection.Custom 导入 DetectionModelTrainer

~\anaconda3\envs\ImageAI\lib\site-packages\imageai\Detection\Custom_init_.py 中 19 导入 cv2 20 ---> 21 tf.config.run_functions_eagerly(真) 22 os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" 23

~\anaconda3\envs\ImageAI\lib\site-packages\tensorflow_core\python\util\module_wrapper.py in getattr(self,name) 191 def getattr(自我,姓名): 192 尝试: --> 193 attr = getattr(self._tfmw_wrapped_module,name) 194 属性错误除外: 195如果不是self._tfmw_public_apis:

属性错误:模块“tensorflow._api.v1.config”没有属性“run_functions_eagerly”

这里有什么问题? 提前致谢

解决方法

你可以这样试试:

import tensorflow.compat.v1 as tf
tf.config.experimental_run_functions_eagerly(True)
@tf.function
def fn():
  # `enter code here

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