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]
快速和脏:'排序(att)[: - 3]'? – SuperSaiyan
谢谢,只是编辑我的问题,以避免误解。 @SuperSaiyan –
https://www.tensorflow.org/versions/r0.9/api_docs/python/nn.html#top_k –