首页 > 解决方案 > 理解 tf.cond 的图

问题描述

我试图通过查看用于构建它的低级操作图来了解 tf.cond 的内部工作原理。

这是有问题的代码

x = tf.constant(1, name='x')
y = tf.constant(2, name='y')
z = tf.constant(3, name='z')

result = tf.cond(tf.less(x, y), lambda: tf.add(x, z), lambda: tf.square(y))

和结果

我想知道的是以下内容。

谢谢,

小号

标签: tensorflow

解决方案


推荐阅读