**

问题描述

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

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

TypeError: call() takes from 2 to 3 positional arguments but 4 were give
AttributeError: module 'tensorflow' has no attribute 'placeholder'

问题原因:

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

问题解决:

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

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

相关文章: