In your case you could probably use top_k
which returns the highest k
values. k
can be a 1D vector defining how many values to 'top' per dimensions. In your case, if you want the second axis set k=[0, 5, 0]
might do it.
tf.nn.top_k(matrix, k=[0,5,0], sorted=True)
I didn't run it tho.
Hope this helps
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…