from keras.layers import Input, Embedding
first_input = Input(shape = (your_shape_tuple))
second_input = Input(shape = (your_shape_tuple))
...
embedding_layer = Embedding(embedding_size)
first_input_encoded = embedding_layer(first_input)
second_input_encoded = embedding_layer(second_input)
...
Rest of the model....
emnedding_layerは共有重みを持ちます。多くの入力がある場合は、レイヤーのリストの形でこれを行うことができます。
何をしたいことは入力のテンソルを変換されている場合は、それを行う方法は次のとおりです。
from keras.layers import Input, Embedding
# If your inputs are all fed in one numpy array :
input_layer = Input(shape = (num_input_indices,))
# the output of this layer will be a 2D tensor of shape (num_input_indices, embedding_size)
embedded_input = Embedding(embedding_size)(input_layer)
は、あなたが探していたものを、このですか?
隠れた表現を複数の出力の形で保存したいのですか、それとも1つの特徴ベクトルを作成しますか? –
最初の隠れ層では、入力ごとに1つずつ、複数の異なる出力にする必要があります。ナシム・ベンの答えの下で私の2番目のコメントを見てください。どうもありがとうございました! :-) –