【发布时间】:2017-09-28 10:35:30
【问题描述】:
我在词嵌入序列上使用 RNN 来对句子进行分类。起初,我提供预训练的词嵌入,一切正常。我将嵌入矩阵设为tf.placeholder,其维度为(词汇大小、嵌入大小),并从 GloVe 提供了一些预训练的嵌入。我还使用tf.nn.embedding_lookup 将我的输入(即单词 ID 序列)转换为嵌入序列。
然后我想让模型也训练嵌入,所以我将嵌入矩阵设为tf.Variable 而不是占位符。现在 TensorFlow 给了我这个错误——显然 AdamOptimizer 无法处理嵌入查找。知道发生了什么或如何解决这个问题?
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input 0 of node
Adam/update_embeddings/AssignSub was passed float from _recv_embeddings_0:0
incompatible with expected float_ref.
【问题讨论】:
标签: python tensorflow nlp lstm