tensorflow高版本适配低版本解决方法
tensorflow高版本适配低版本解决方法
IDE: PyCharm
tf版本: 2.4
问题
tensorflow2.4与原2.0不匹配,使用如下方法,IDE提示找不到compat模块。
失败的方法
import tensorflow.compat.v1 as tf
tf.disable_v2_behaviour()
错误提示:找不到compat模块
解决:
import tensorflow as tf2
tf = tf2.compat.v1
tf.disable_v2_behavior()
跟原来的在理论上没有区别
————————————————
转载:
原文链接:感谢原文方法