2016-06-14 61 views
0

我在seq2seq基於TensorFlow建立自己的關注模型。我想知道我怎麼可以這樣做如下的僞代碼TensorFlow:如何在TensorFlow中獲得最大3張張?

att = [0.2,0.3,0.5,0.1,0.9,0.2]# This is a tensor or a list of tensors 
result = maximum3numbers(att) 

接受的結果可能是:

result = [0.9,0.5,0.3] 

result = [4,2,1] 
+0

快速和髒:'排序(att)[: - 3]'? – SuperSaiyan

+0

謝謝,只是編輯我的問題,以避免誤解。 @SuperSaiyan –

+1

https://www.tensorflow.org/versions/r0.9/api_docs/python/nn.html#top_k –

回答