def test_binary_ops_combined(self):
# computation
a = tf.placeholder(tf.float32, shape=(2, 3))
b = tf.placeholder(tf.float32, shape=(2, 3))
c = tf.add(a, b)
d = tf.mul(c, a)
e = tf.div(d, b)
f = tf.sub(a, e)
g = tf.maximum(a, f)
# value
a_val = np.random.rand(*tf_obj_shape(a))
b_val = np.random.rand(*tf_obj_shape(b))
# test
self.run(g, tf_feed_dict={a: a_val, b: b_val})
评论列表
文章目录