1
トーチには、torch.Minという名前のモジュールがあり、ネットワークのさまざまなブランチでmin演算を適用できます。テンソルフローのTorch.Min
tensorflowで同様のものがあります?。 (テンソルフローのnoob)
トーチには、torch.Minという名前のモジュールがあり、ネットワークのさまざまなブランチでmin演算を適用できます。テンソルフローのTorch.Min
tensorflowで同様のものがあります?。 (テンソルフローのnoob)
私はあなたがほしいと思うと思うtf.reduce_min。 [10, 3, 5, 4]
の分を見つけるには:
import tensorflow as tf
def one_dim_graph():
input_tensor = tf.constant([10, 3, 5, 4])
tensor_min = tf.reduce_min(input_tensor)
return input_tensor, tensor_min
def run():
in_one, g_one = one_dim_graph()
with tf.Session() as sess:
sess.run(tf.initialize_all_variables())
out_one = sess.run([g_one])
print in_one
print out_one
run()
これはあなたの分を与える:
Tensor("Const_74:0", shape=(4,), dtype=int32)
[3]
をあなたはまた、マルチ次元テンソル全体でこれを使用すると、すべての次元を減らすか、または特定の次元に沿って削減することができます。我々は見つけることができます
[[1, 4, 3, 10],
[6, 5, 2, 12],
[9, 7, 8, 11]]
:
[1]
tf.reduce_min(input_tensor)
[1, 4, 2, 10]
とtf.reduce_min(input_tensor, reduction_indices=0)
[1, 2, 7]
とtf.reduce_min(input_tensor, reduction_indices=1)