解决AttributeError: module ‘keras.utils‘ has no attribute ‘plot_model‘

简介: 解决AttributeError: module ‘keras.utils‘ has no attribute ‘plot_model‘

2022-01-01 19:41:58.347964: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Traceback (most recent call last):
  File "E:/Code/PyCharm/TensorFlow学习/Keras/多输入多输出.py", line 36, in <module>
    keras.utils.plot_model(model, "multi_input_and_output_model.png", show_shapes=True)
AttributeError: module 'keras.utils' has no attribute 'plot_model'

出现问题原因:

报错原因是keras.utils模块下没有plot_model这个函数,keras有两个实现模块,分别是kerastensorflow.keras这两个模块一般情况下是可以相互转换的,前者的函数都可以换成第二个运行,但是第二个模块中的有些函数API在keras中没有实现

解决方案:

import keras换成from tensorflow import keras

from tensorflow import keras


目录
相关文章
Py之utils:utils库的简介、安装、使用方法之详细攻略
Py之utils:utils库的简介、安装、使用方法之详细攻略
Py之utils:utils库的简介、安装、使用方法之详细攻略
|
关系型数据库 Linux 数据库
|
机器学习/深度学习 计算机视觉 Python
模型预测笔记(三):通过交叉验证网格搜索机器学习的最优参数
本文介绍了网格搜索(Grid Search)在机器学习中用于优化模型超参数的方法,包括定义超参数范围、创建参数网格、选择评估指标、构建模型和交叉验证策略、执行网格搜索、选择最佳超参数组合,并使用这些参数重新训练模型。文中还讨论了GridSearchCV的参数和不同机器学习问题适用的评分指标。最后提供了使用决策树分类器进行网格搜索的Python代码示例。
1095 1
|
10月前
|
机器学习/深度学习 并行计算 异构计算
WINDOWS安装eiseg遇到的问题和解决方法
通过本文的详细步骤和问题解决方法,希望能帮助你顺利在 Windows 系统上安装和运行 EISeg。
401 2
|
定位技术 Python Windows
彻底卸载并重装Anaconda环境与Python的方法
彻底卸载并重装Anaconda环境与Python的方法
7649 1
|
Web App开发 Ubuntu Linux
Ubuntu搭建vscode服务器
Ubuntu搭建vscode服务器
|
SQL 存储 关系型数据库
Hive 元数据更新
【8月更文挑战第12天】
345 1
|
Windows
LabVIEW播放视频文件的方法与例程
LabVIEW播放视频文件的方法与例程
296 1
|
JavaScript Java 测试技术
基于Java的医疗系统实现的设计与实现(源码+lw+部署文档+讲解等)
基于Java的医疗系统实现的设计与实现(源码+lw+部署文档+讲解等)
143 3
|
网络安全 安全 数据安全/隐私保护
网站认证的类型有哪些?
【6月更文挑战第2天】网站认证的类型有哪些?
261 0