【问题标题】:tensorflow eager execution changes at runtimetensorflow 急切执行在运行时发生变化
【发布时间】:2021-02-09 16:18:07
【问题描述】:

我正在使用 tensor2tensor (1.9.0) 和 tensorflow 1.9。当我尝试在 t2t-decoder 中启用 Eager Execution tf.enable_eager_execution() 时,它工作得很好。但是,当程序在 tensor2tensor 的 python 代码中中断时,我发现急切执行已被禁用。试图在 t2t 框架内寻找任何可能禁用它的东西,但我找不到任何可能做到这一点的东西。

版本:t2t 1.9.0 张量流(CPU)1.9.0 蟒蛇3.6 Ubuntu 18.04

【问题讨论】:

    标签: tensorflow tensor2tensor


    【解决方案1】:

    我使用的是 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())   
    

    输出:

     [5,6]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-06-23
      • 1970-01-01
      • 1970-01-01
      • 2018-11-23
      • 2019-04-25
      • 2019-03-17
      • 2019-08-29
      相关资源
      最近更新 更多