報錯
AttributeError: module 'tensorflow' has no attribute 'assign'
AttributeError: module 'tensorflow' has no attribute 'variable_scope'
等等..
走的彎路
很多說2.0版本棄用contrib,叫重裝低版本tf.
slim包不能用還下載了tf-slim 包,鏈接如下:
https://github.com/google-research/tf-slim
還有的說在tf2.0棄用的包整合到一個叫module的擴展包裏了...
解決辦法
使用如下兩句
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
替換原有的
import tensorflow as tf
————————————————
參考
https://blog.csdn.net/flowingfog/java/article/details/93597697