python - ImportError:无法从部分初始化的模块“tensorflow_estimator.python.estimator.canned.dnn”导入名称“dnn_logit_fn_builder”
问题描述
导入时使用jupyter notebook
in aconda env
会导致该错误tensorflow_hub
:
ImportError: cannot import name 'dnn_logit_fn_builder' from partially initialized module
'tensorflow_estimator.python.estimator.canned.dnn' (most likely due to a circular import)
(C:\Users\Anaconda3\envs\my_env\lib\site-packages\tensorflow_estimator\python\estimator\canned\dnn.py)
我的环境是通过安装 pandas、tensorflow-hub、numpy、tensorflow 和 python=3.8.5 创建的。
更多细节:
tensorflow 2.3.0
tensorflow-base 2.3.0
tensorflow-estimator 2.3.0 conda-forge
tensorflow-hub 0.12.0 conda-forge
为什么我会收到此错误?
解决方案
与 Tensorflow 2.6.0 一起使用,api 名称几乎没有变化tf.compat.v1.estimator.experimental.dnn_logit_fn_builder
import tensorflow as tf
tf.compat.v1.estimator.experimental.dnn_logit_fn_builder
推荐阅读
- javascript - 聚合物:何时调用观察者
- c# - 设置 [PARAMETER] 的值时意外结束 - 当在线验证器说字符串是无效 JSON 时,Visual Studio 说字符串无效
- web-services - Talend tRestClient:如何在 POST 请求中设置正文
- javascript - 将 JSON 从 Firebase 转换为 GeoJSON 并显示在地图上
- amazon-web-services - spark aws S3a ARN(亚马逊资源名称)IAM 角色
- php - 在某些页面上从 Wordpress 页眉/页脚中省略元素的最佳方法
- vba - VBA 将范围保存为工作簿
- c - 为什么这里只使用一次 if 呢?
- c++ - 使用不同的 FUSION_MAX_VECTOR_SIZE(和类似的)构建的翻译单元是否可以相互链接?
- java - 如何使 CountDownTimer 计数为 1?