当我打印tf.case
的输出时,它给出了ValueError: Operation 'case_11/cond/Merge' has been marked as not fetchable.
代码如下:
a = tf.random_uniform([],minval = -1,maxval = 1)
b = tf.random_uniform([],minval = -1,maxval = 1)
def f1(): return a + b
def f2(): return a - b
def f3(): return tf.constant(0.0)
out2 = tf.case({tf.less(a,b):f1,tf.greater(a,b):f2},default = f3,exclusive = True)
print(sess.run(out2))
PS:但这不是tf.cond()
的问题。
请在这里帮助我。 谢谢!