菜尼奥排错之keras ‘tensorflow.compat.v2.__internal__‘ has no attribute ‘register_clear_session_function‘
环境版本:
Ubuntu 16.04.2 LTS
Nvidia GeForce RTX 3080*2 CUDA Version 11.2
tensorflow 2.5.0
keras 2.7.0
报错信息:
训练时报错如下:
AttributeError: module 'tensorflow.compat.v2.__internal__' has no attribute 'register_clear_session_function'
解决方法:
之前python脚本头:
from keras.models import Model
from keras.layers import Input, Conv2D, GlobalAveragePooling2D, Dropout
from keras.layers import Activation, BatchNormalization, Add, Reshape, DepthwiseConv2D
from keras.utils.vis_utils import plot_model
from keras.optimizers import Adam
from keras.preprocessing.image import ImageDataGenerator
from keras.callbacks import EarlyStopping
from keras import backend as K
修改为如下即可:
from tensorflow.python.keras.models import Model
from tensorflow.python.keras.layers import Input, Conv2D, GlobalAveragePooling2D, Dropout
from tensorflow.python.keras.layers import Activation, BatchNormalization, Add, Reshape, DepthwiseConv2D
from tensorflow.python.keras.utils.vis_utils import plot_model
from tensorflow.keras.optimizers import Adam
from tensorflow.python.keras.preprocessing.image import ImageDataGenerator
from tensorflow.python.keras.callbacks import EarlyStopping
from tensorflow.python.keras import backend as K
根本原因:
tensorflow-gpu 1.12(tf一代keras)的代码在tensorflow2.x(tf2二代keras)使用时,keras模块调用路径变更了而已。诸如此类问题还有一大推。
菜尼奥排错之keras ‘tensorflow.compat.v2.__internal__‘ has no attribute ‘register_clear_session_function‘相关推荐
- 菜尼奥排错之keras TypeError: _init_subclassed_network() got an unexpected keyword argument ‘input‘
环境版本: Ubuntu 18.04.2 LTS Nvidia GeForce RTX2080super CUDA Version 10.0 tensorflow-gpu 1.13.1 keras 2 ...
- 菜尼奥排错之merge6 = merge([drop4,up6], mode = ‘concat‘...)TypeError: ‘module‘ object is not callable
环境版本: Ubuntu 18.04.2 LTS Nvidia GeForce RTX2080super CUDA Version 10.0 tensorflow-gpu 1.13.1 keras 2 ...
- 菜尼奥排错之TensorRT libmyelin.so.1: cannot open shared object file: No such file or directory
环境版本: Ubuntu 18.04.2 LTS Nvidia GeForce RTX2080super CUDA Version 10.0 cuDNN Version 7.6 cmake 3.17. ...
- ModuleNotFoundError: No module named ‘tensorflow.compat.v2‘解决方法
ModuleNotFoundError: No module named 'tensorflow.compat.v2'解决方法 原因: tensorflow和keras版本不对齐或者keras版本过高 ...
- No modules named ‘tensorflow.compat.v2‘
出现这个问题就说明.tensorflow的版本有问题, tf.compat.v2 module was added in 1.14. Upgrade to 1.14 , 1.15, or 2.0 an ...
- 运行tensorflow-datasets遇到import tensorflow.compat.v2 as tf报错ImportError: No module named tensorflow.V2
运行tensorflow-datasets遇到import tensorflow.compat.v2 as tf报错ImportError: No module named tensorflow.V2 ...
- AttributeError: module ‘tensorflow._api.v2.train‘ has no attribute ‘NewCheckpointReader‘解决方案
解决AttributeError: module 'tensorflow._api.v2.train' has no attribute 'NewCheckpointReader' 问题描述: Ten ...
- AttributeError: module ‘tensorflow._api.v2.data‘ has no attribute ‘AUTOTUNE‘
tensorflow2 AttributeError: module 'tensorflow._api.v2.data' has no attribute 'AUTOTUNE' 报错信息 Attrib ...
- module ‘tensorflow._api.v2.data‘ has no attribute ‘AUTOTUNE
module 'tensorflow._api.v2.data' has no attribute 'AUTOTUNE module 'tensorflow._api.v2.data' has no ...
最新文章
- (转)uml 静态视图依赖
- IBM首席执行官提出人工智能部署三大基本原则
- curl获取网页内容出现乱码或为空的解决方案,另附curl_getinfo函数解析
- MFC使用CCommandLineInfo处理命令行
- 腾讯会议核心数据库TDSQL,如何做到快速无损在线扩容?
- Oozie JMS通知消息实现--根据作业ID来过滤消息
- Nodejs学习笔记(六)——Mysql模块
- LeetCode 688. “马”在棋盘上的概率
- 招聘云计算、虚拟化、前端开发、测试等工程师
- linux下文件打包、压缩详解
- Windows不同压缩软件、压缩算法、压缩率详细对比测试与选择
- [转载]MTK入门教程
- canvas中文显示乱码 html5_HTML5 CANVAS:绘制文字
- 科目三: 济南章丘五号线
- 如何通俗的解释全微分?
- APP上传照片后台实现方法
- 搜索引擎广告和信息流广告有什么区别?
- DEM数据获取、数据镶嵌、掩膜提取
- GIF录制神器--GIF123
- 手把手学习Vue3.0:CSS样式基础和HTML5基础收藏
热门文章
- 程序猿媛都偷偷深爱的九大习惯
- Firefox火狐浏览器无法调试
- 小程序 this.$scope.globalData与getApp().globalData
- vscode更换主题的插件_vscode插件开发:定制 vscode 主题插件扩展
- FCW车辆安全距离算法
- 「NOI2016」循环之美 解题报告
- python数组使用reverse反转
- 一文学会常规转录组分析
- 全栈开发工程师微信小程序 - 上
- 题目: =====i am biter逆置为: biteram i函数原型: