AttributeError: module 'tensorflow' has no attribute 'placeholder'

**

问题描述

使用Colab时出现此错误,如下图所示:
**
AttributeError: module ‘tensorflow’ has no attribute ‘placeholder’

如果你使用convert code,还可能会出现下面这样的错误

TypeError: call() takes from 2 to 3 positional arguments but 4 were give

问题原因:

其实很简单,Colab把tensorflow换成2.0版本了

问题解决:

其实更简单,只要在代码开头加上下面这一句就好了,但是注意加上以后要把解释器重启一下才管用!
%tensorflow_version 1.x

发布了5 篇原创文章 · 获赞 0 · 访问量 266

猜你喜欢

转载自blog.csdn.net/Nick_Dizzy/article/details/105349692