Преглед изворни кода

修改tf1.py的错误

由于使用TensorFlow2导致的问题。
justidle2012 пре 6 година
родитељ
комит
9232338c1a
1 измењених фајлова са 3 додато и 2 уклоњено
  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个输入端子,指定类型和名字