为什么我不能导入 Tensorflow.contrib 我收到 No module named 'tensorflow.python.saved 的错误

编程入门 行业动态 更新时间:2024-10-15 08:18:35
本文介绍了为什么我不能导入 Tensorflow.contrib 我收到 No module named 'tensorflow.python.saved 的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我刚刚在 Mac 上安装了 Tensorflow,我想使用 tf.contrib.slim 但是当我使用它时,我得到了这个

Hi I just installed Tensorflow on my Mac and I want to use tf.contrib.slim but when I use it I get this

import tensorflow as tf

slim = tf.contrib.slim

错误:

文件/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/export/export_lib.py",第 25 行,在从 tensorflow.python.saved_model.model_utils import build_all_signature_defs ModuleNotFoundError: No module named'tensorflow.python.saved_model.model_utils'

File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/export/export_lib.py", line 25, in from tensorflow.python.saved_model.model_utils import build_all_signature_defs ModuleNotFoundError: No module named 'tensorflow.python.saved_model.model_utils'

我不知道该怎么办,请帮帮我

I don't know what to do, please help me

我使用 Tensorflow.13.1python 3.7

推荐答案

适用于正在尝试使用 Tensorflow 1.xxgithub 中的一些旧代码的任何人 版本同时具有 Tensorflow 2.0.x 请注意 tf.contribTensorflow 2.0.x 中不再存在,并且它的模块被移动.
请在没有 tf.contrib 部分的情况下使用谷歌搜索模块的名称,以了解它的新位置,从而通过更正 import 语句来相应地迁移您的代码.

For anyone who is trying some old codes from github with Tensorflow 1.x.x versions while having Tensorflow 2.0.x please note that tf.contrib no longer exist in Tensorflow 2.0.x and it's modules were moved.
Please google the name of the module without the tf.contrib part to know it's new location and thus migrating your code accordingly by correcting the import statement.

希望这有帮助!

这篇关于为什么我不能导入 Tensorflow.contrib 我收到 No module named 'tensorflow.python.saved 的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-05-01 05:12:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1405474.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   module   named   Tensorflow   contrib

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!