【发布时间】:2016-06-20 08:52:44
【问题描述】:
假设我有以下代码:
x = tf.placeholder("float32", shape=[None, ins_size**2*3], name = "x_input")
condition = tf.placeholder("int32", shape=[1, 1], name = "condition")
W = tf.Variable(tf.zeros([ins_size**2*3,label_option]), name = "weights")
b = tf.Variable(tf.zeros([label_option]), name = "bias")
if condition > 0:
y = tf.nn.softmax(tf.matmul(x, W) + b)
else:
y = tf.nn.softmax(tf.matmul(x, W) - b)
if 语句在计算中是否有效(我不这么认为)?如果没有,如何在 TensorFlow 计算图中添加 if 语句?
【问题讨论】:
标签: python if-statement tensorflow