我试图对简单的代码执行急切的执行。我在 Jupyter Notebook 和 Spyder IDE 上都试过了。使用 Jupyter 我没有问题,但是当我在 Spyder 中执行代码时,它返回一个错误: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
提交
取消