遇到的第一个问题就是不同版本代码的不兼容问题。
比如:module ‘tensorflow’ has no attribute ‘placeholder’?
还有很多2.x版本中没有1.x模块的
搜了很多博客,都说的是
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
但是我这里提示是没有这个compat模块,后来查找到资料说是把代码中调用模块的代码部分tf换成tf.compat.v1,比如下面的。
tf.placeholder(type, shape)
tf.compat.v1.placeholder(type,shape)
这样就可以了。
参考链接https://cloud.tencent.com/developer/article/1473538