Reputation: 1021
According to the Tensorflow API, I know that I can reduce_min or reduce_max along a specific axis. I can also select the minimum tensor among two tensors as the following.
min = tf.minimum(x, y)
However, I want to know how I can select the minimum tensor among a group of tensors. If there is a function like min or max in tensor?
Thank you so much!
Upvotes: 1
Views: 1305
Reputation: 17191
You can stack
all the tensors and then use reduce_min
a = tf.constant([3])
b = tf.constant([2])
c = tf.constant([1])
with tf.Session() as sess:
print(tf.reduce_min(tf.stack([a,b,c]),0).eval())
#[1]
Upvotes: 1