2016-06-14 65 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 –

回答