【发布时间】:2019-04-07 15:33:15
【问题描述】:
在文档中,tf.while_loop 的主体必须是可调用的 Python。
i = tf.constant(0)
b = lambda i: tf.add(i,1)
c = lambda i: tf.less(i,10)
tf.while_loop(c,b, [i])
有效但
def b(i):
tf.add(i,1)
i = tf.constant(0)
c = lambda i: tf.less(i,10)
tf.while_loop(c,b, [i])
抛出一个 ValueError:尝试将具有不受支持的 type() 的值 (None) 转换为张量
2.0默认是eager execution,不知道是什么问题?!
【问题讨论】:
-
我认为你的
b函数应该return一些东西。
标签: python tensorflow tensorflow2.0 eager-execution