简体   繁体   English

tensorflow 在运行时急切执行更改

[英]tensorflow eager execution changes at runtime

I'm using with tensor2tensor (1.9.0) and tensorflow 1.9.我正在使用 tensor2tensor (1.9.0) 和 tensorflow 1.9。 When i try to enable eager execution tf.enable_eager_execution() in t2t-decoder it works just fine.当我尝试在 t2t-decoder 中启用急切执行tf.enable_eager_execution()时,它工作得很好。 However, when the program breaks inside the python code of tensor2tensor, i find that the eager execution has been disabled.但是,当程序在 tensor2tensor 的 python 代码中中断时,我发现急切执行已被禁用。 tried to grep for anything that could be disabling it within t2t framework but i can't find anything that could potentially do that.尝试使用 grep 寻找任何可能在 t2t 框架内禁用它的东西,但我找不到任何可能做到这一点的东西。

versions: t2t 1.9.0 tensorflow (cpu) 1.9.0 python 3.6 ubuntu 18.04版本: t2t 1.9.0 tensorflow (cpu) 1.9.0 python 3.6 ubuntu 18.04

I am using python 3. I had to put tensorflow and tf.enable_eager_execution at the top of my script我正在使用 python 3。我必须将 tensorflow 和 tf.enable_eager_execution 放在我的脚本顶部

 import tensorflow as tf
 tf.enable_eager_execution()

 you may have to shutdown the kernal and jupyter notes than reopen them.

 a=tf.Variable([1,2])
 a.assign([5, 6])

 print(a.numpy())   

output: output:

 [5,6]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM