Parcourir la source

修改tf1.py的错误

由于使用TensorFlow2导致的问题。
justidle2012 il y a 6 ans
Parent
commit
9232338c1a
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      ch01/tf1.py

+ 3 - 2
ch01/tf1.py

@@ -1,5 +1,6 @@
-import tensorflow as tf
-assert tf.__version__.startswith('1.')
+import tensorflow.compat.v1 as tf
+tf.disable_v2_behavior()
+assert tf.__version__.startswith('2.')
 
 # 1.创建计算图阶段
 # 创建2个输入端子,指定类型和名字