更新时间:2023-12-01 22:10:58
当您说三个单词嵌入"时,我看到三个嵌入层,例如:
When you say "three word embeddings", I see three Embedding layers, such as:
input1 = Input((sentenceLength,))
input2 = Input((sentenceLength,))
input3 = Input((sentenceLength,))
emb1 = Embedding(...options...)(input1)
emb2 = Embedding(...options...)(input2)
emb3 = Embedding(...options...)(input3)
您可以使用简单的Add()
层对这三个层求和:
You can use a simple Add()
layer to sum the three:
summed = Add()([emb1,emb2,emb3])
然后您继续建模...
Then you continue your modeling...
#after creating the rest of the layers and getting the desired output:
model = Model([input1,input2,input3],output)
如果您不使用嵌入层,但是要输入三个向量:
If you're not using embedding layers, but you're inputting three vectors:
input1 = Input((4,)) #or perhaps (sentenceLength,4)
input2 = Input((4,))
input3 = Input((4,))
added = Add()([input1,input2,input3])
其余的都一样.
如果这不是您的问题,请提供三个单词嵌入"的来源,打算如何选择它们的详细信息,等等.
If this is not your question, please give more details about where the three "word embeddings" are coming from, how you intend to select them, etc.