فهرست منبع

修改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个输入端子,指定类型和名字