惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CXSECURITY Database RSS Feed - CXSecurity.com
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Docker
博客园 - 叶小钗
Recent Announcements
Recent Announcements
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
Vercel News
Vercel News
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
美团技术团队
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
F
Fortinet All Blogs
博客园 - 三生石上(FineUI控件)
Microsoft Security Blog
Microsoft Security Blog
H
Heimdal Security Blog
有赞技术团队
有赞技术团队
The Cloudflare Blog
S
Secure Thoughts
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
The Blog of Author Tim Ferriss
M
MIT News - Artificial intelligence
Google DeepMind News
Google DeepMind News
Schneier on Security
Schneier on Security
N
News and Events Feed by Topic
小众软件
小众软件
C
Cybersecurity and Infrastructure Security Agency CISA
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - Franky
T
Tenable Blog
The Last Watchdog
The Last Watchdog
腾讯CDC
量子位
Google DeepMind News
Google DeepMind News
Help Net Security
Help Net Security
雷峰网
雷峰网
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyberwarzone
Cyberwarzone
S
Securelist
Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Proofpoint News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
I
InfoQ
Spread Privacy
Spread Privacy
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - cpuimage

AIGC图像困局 深度学习优化器算法巧思速览 lora训练之偷师 大话AI绘画技术原理与算法优化 Tensorflow2 深度学习十必知 开源发丝分割数据集CelebAHairMask-HQ(国庆献礼) 博文大纲 文字渲染一探 磨皮美颜算法 附完整C代码 Windows下C,C++开发环境搭建指南 一种简单高效的音频降噪算法示例(附完整C代码) 算法踩坑小记 音频算法之我思 wav2midi 音乐旋律提取算法 附可执行demo 图像去模糊算法 循序渐进 附完整代码 音频算法之小黄人变声 附完整C代码 音频识别算法思考与阶段性小结 大话音频变声原理 附简单示例代码 c语言智能指针 附完整示例代码
自 TensorFlow 2.6 起,修正IDE代码自动补全失效的方法
cpuimage · 2022-02-06 · via 博客园 - cpuimage

很久没写博文,写这个,只是纯粹为了吐槽tf越升级,问题越多。

自TensorFlow 2.6 至 TensorFlow 2.9.1

各个IDE工具的tf.keras 自动补全失效了。

修正办法:

修改python的tensorflow包初始化文件:

site-packages\tensorflow\_init_.py

将其中的代码:

_keras_module = "keras.api._v2.keras"
keras = _LazyLoader("keras", globals(), _keras_module)
_module_dir = _module_util.get_parent_dir_for_name(_keras_module)
if _module_dir:
  _current_module.__path__ = [_module_dir] + _current_module.__path__
setattr(_current_module, "keras", keras)

改为:

import typing as _typing 
if _typing.TYPE_CHECKING: 
  from keras.api._v2 import keras
else:
  _keras_module = "keras.api._v2.keras"
  keras = _LazyLoader("keras", globals(), _keras_module)
  _module_dir = _module_util.get_parent_dir_for_name(_keras_module)
  if _module_dir:
    _current_module.__path__ = [_module_dir] + _current_module.__path__
  setattr(_current_module, "keras", keras)

重启IDE即可。

相关issues见链接:

https://github.com/tensorflow/tensorflow/issues/53144#issuecomment-985179600

看到很多人都转投pytorch了,博主还在坚守tensorflow阵地。

怒其不争,TensorFlow团队能少搞点幺蛾子不~