多维上的Tensorflow embedding_lookup

问题描述 投票:0回答:1

我想选择这个张量的一部分。

A = tf.constant([[[1,1],[2,2],[3,3]], [[4,4],[5,5],[6,6]]])

A的输出为

[[[1 1]
  [2 2]
  [3 3]]

 [[4 4]
  [5 5]
  [6 6]]]

我要从A选择的索引是[1、0]。我的意思是该张量的第一部分的[2 2]和第二部分的[4 4],所以我的预期结果是

[2 2]
[4 4]

如何使用embedding_lookup函数?

B = tf.nn.embedding_lookup(A, [1, 0])

我已经尝试过]

但这不是我的期望。

[[[4 4]
  [5 5]
  [6 6]]

 [[1 1]
  [2 2]
  [3 3]]]

有人可以帮我解释一下该怎么做吗?

我想选择这个张量的一部分。 A = tf.constant([[[[1,1],[2,2],[3,3]],[[4,4],[5,5],[6,6]]])输出A的值为[[[1 1] [2 2] [3 3]] [[4 4] [5 5] [6 6]]]索引I ...

python tensorflow embedding
1个回答
0
投票

尝试以下操作,

© www.soinside.com 2019 - 2024. All rights reserved.