tensorflow1.0到tensorflow2.0的跨度也太大了吧。怎么解决更新以后很多程序不能用问题

tensorflow1.0到tensorflow2.0的跨度也太大了吧,各种出现
AttributeError: module ‘tensorflow’ has no attribute ‘placeholder’
AttributeError: module ‘tensorflow’ has no attribute 'Session’等等问题。原来v1里面的很多常用函数都没了,tensorflow2.0 把不常用的移除了,把很多函数名字用法也做了修改,改动太大,要是一个个手动改实在太麻烦了。

所以干脆把v2的tensorflow先降为v1吧,把原本的

import tensorflow as tf 改写为 
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

你可能感兴趣的:(tensorflow1.0到tensorflow2.0的跨度也太大了吧。怎么解决更新以后很多程序不能用问题)