我試圖對簡單的代碼執(zhí)行急切的執(zhí)行。我在 Jupyter Notebook 和 Spyder IDE 上都試過了。使用 Jupyter 我沒有問題,但是當我在 Spyder 中執(zhí)行代碼時,它返回一個錯誤:File "C:\...\lib\site-packages\tensorflow\python\framework\ops.py", line 5496, in enable_eager_execution "tf.enable_eager_execution must be called at program startup.")ValueError: tf.enable_eager_execution must be called at program startup.代碼如下:import tensorflow as tftf.enable_eager_execution ()import tensorflow.contrib.eager as tfedef square (x): return tf.multiply (x, x)grad = tfe.gradients_function (square)print (grad (3.))
添加回答
舉報
0/150
提交
取消