Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Keras嵌入层与LSTM_Keras_Lstm_Recurrent Neural Network - Fatal编程技术网

Keras嵌入层与LSTM

Keras嵌入层与LSTM,keras,lstm,recurrent-neural-network,Keras,Lstm,Recurrent Neural Network,我原来的模型是: input = Input(shape=(1, 6)) # 1 time step, 6 features LSTM_layer = LSTM(self.lstm_units, return_sequences=False, return_state=True) lstm_output, out_h, out_c = LSTM_layer(embedded, initial_state=[h, c]) 输入是一个单热向量,例如[0,1,0,0,0,0] 现在我已经读到,最好将

我原来的模型是:

input = Input(shape=(1, 6)) # 1 time step, 6 features
LSTM_layer = LSTM(self.lstm_units, return_sequences=False, return_state=True)
lstm_output, out_h, out_c = LSTM_layer(embedded, initial_state=[h, c])
输入是一个单热向量,例如[0,1,0,0,0,0]
现在我已经读到,最好将输入嵌入到LSTM,所以模型现在看起来像

input = Input(shape=(6,))
embedded = Embedding(6, 2, input_length=6)(input)
LSTM_layer = LSTM(self.lstm_units, return_sequences=False, return_state=True)
lstm_output, out_h, out_c = LSTM_layer(embedded, initial_state=[h, c])

虽然这是可行的,但我的问题是,嵌入层的输出现在是(?,6,2)。这是LSTM层眼中的6个时间步和2个特征。这是实现这种方法的正确方法吗?

你能解释一下你想做什么吗?为什么要嵌入输入?@Digital Thinking我正在尝试实现ENAS()。虽然输入的维度很低,不足以证明使用嵌入层是合理的,但他们似乎还是使用了它。另外,知道如何解决这个问题也很好。