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

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
L
LangChain Blog
Engineering at Meta
Engineering at Meta
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
IT之家
IT之家
The Register - Security
The Register - Security
月光博客
月光博客
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
博客园 - 聂微东
云风的 BLOG
云风的 BLOG
Microsoft Security Blog
Microsoft Security Blog
腾讯CDC
W
WeLiveSecurity
博客园_首页
A
About on SuperTechFans
G
Google Developers Blog
博客园 - 叶小钗
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
量子位
Google DeepMind News
Google DeepMind News
博客园 - 【当耐特】
aimingoo的专栏
aimingoo的专栏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 三生石上(FineUI控件)
N
News | PayPal Newsroom
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
AI
AI
TaoSecurity Blog
TaoSecurity Blog
P
Proofpoint News Feed
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - 司徒正美
www.infosecurity-magazine.com
www.infosecurity-magazine.com
J
Java Code Geeks
Hacker News - Newest:
Hacker News - Newest: "LLM"
爱范儿
爱范儿
S
SegmentFault 最新的问题
Martin Fowler
Martin Fowler
Vercel News
Vercel News
Schneier on Security
Schneier on Security
Know Your Adversary
Know Your Adversary
H
Heimdal Security Blog
N
News and Events Feed by Topic

博客园 - 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团队能少搞点幺蛾子不~