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

42 篇文章 7 订阅
32 篇文章 1 订阅

在这里插入图片描述

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

海洋 之心

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值