我正在与tf.nn.embeddding_lookup()
一起工作,但是没有工作。我正在尝试找出问题,但我无法做到这是我的代码
import tensorflow as tf
batchSize = 24
lstmUnits = 64
numClasses = 2
iterations = 10000
maxSeqLength=250
tf.reset_default_graph()
labels = tf.placeholder(tf.float32, [batchSize, numClasses])
input_data = tf.placeholder(tf.float32, [batchSize, maxSeqLength])
data = tf.Variable(tf.zeros([batchSize, maxSeqLength, numDimensions]),dtype=tf.float32)
data = tf.nn.embedding_lookup(wordVectors,input_data)
print(wordVectors)
print(input_data)
wordVectors的输出为
[[[ 0 1]]
[[ 1 1]]
[[ 2 1]]
...
[[14784 1]]
[[14784 1]]
,input_data的输出为
Tensor("Placeholder_1:0", shape=(24, 250), dtype=float32)
运行tf.nn.embedding_lookup函数时出现此错误
Value passed to parameter 'indices' has DataType float32 not in list of allowed values: int32, int64