我试图将三个元素的列表传递给嵌入,然后传递给LSTM作为时间序列,但是我真的不知道是否只传递了一个值为3的向量。代码是
lr = 1e-3
emb_size = 100
look_back = 3
# "Expert" (regular dqn) model architecture
inp = Input(shape=(look_back,))
emb = Embedding(input_dim=env.action_space.n+1, output_dim = emb_size)(inp)
rnn = Bidirectional(LSTM(5))(emb)
out = Dense(env.action_space.n, activation='softmax')(rnn)
expert_model = Model(inputs = inp, outputs = out)
expert_model.compile(loss='categorical_crossentropy', optimizer= Adam(lr))
print(expert_model.summary())
这是摘要:
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
input_1 (InputLayer) (None, 3) 0
_________________________________________________________________
embedding_1 (Embedding) (None, 3, 100) 1100
_________________________________________________________________
bidirectional_1 (Bidirection (None, 10) 4240
_________________________________________________________________
dense_1 (Dense) (None, 10) 110
=================================================================
Total params: 5,450
Trainable params: 5,450
Non-trainable params: 0
_________________________________________________________________