如何在 TensorFlow 中获得最多 3 个张量?
How to get maximum 3 tensor in TensorFlow?
我正在基于 TensorFlow 在 seq2seq 中构建自己的注意力模型。我想知道如何在 TensorFlow 中执行以下伪代码:
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]
我认为 top_k 运算符应该满足您的需求:
https://www.tensorflow.org/versions/r0.9/api_docs/python/nn.html#top_k
我正在基于 TensorFlow 在 seq2seq 中构建自己的注意力模型。我想知道如何在 TensorFlow 中执行以下伪代码:
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]
我认为 top_k 运算符应该满足您的需求:
https://www.tensorflow.org/versions/r0.9/api_docs/python/nn.html#top_k