Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/309.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
Python Keras:为什么在官方的seq2seq示例中没有使用时间分布而不是密集?_Python_Deep Learning_Keras - Fatal编程技术网

Python Keras:为什么在官方的seq2seq示例中没有使用时间分布而不是密集?

Python Keras:为什么在官方的seq2seq示例中没有使用时间分布而不是密集?,python,deep-learning,keras,Python,Deep Learning,Keras,我现在正试图在Keras之上构建seq2seq模型 我提到了这一点,但我想知道为什么不使用TimeDistibuted层而不是Dense # Set up the decoder, using `encoder_states` as initial state. decoder_inputs = Input(shape=(None, num_decoder_tokens)) # We set up our decoder to return full output sequences, # an

我现在正试图在Keras之上构建seq2seq模型

我提到了这一点,但我想知道为什么不使用
TimeDistibuted
层而不是
Dense

# Set up the decoder, using `encoder_states` as initial state.
decoder_inputs = Input(shape=(None, num_decoder_tokens))
# We set up our decoder to return full output sequences,
# and to return internal states as well. We don't use the
# return states in the training model, but we will use them in inference.
decoder_lstm = LSTM(latent_dim, return_sequences=True, return_state=True)
decoder_outputs, _, _ = decoder_lstm(decoder_inputs,
                                     initial_state=encoder_states)
decoder_dense = Dense(num_decoder_tokens, activation='softmax') # <- Here!
decoder_outputs = decoder_dense(decoder_outputs)

# Define the model that will turn
# `encoder_input_data` & `decoder_input_data` into `decoder_target_data`
model = Model([encoder_inputs, decoder_inputs], decoder_outputs)
#设置解码器,使用“编码器状态”作为初始状态。
解码器\u输入=输入(形状=(无,num\u解码器\u标记))
#我们将解码器设置为返回完整的输出序列,
#以及返回内部状态。我们不使用
#在训练模型中返回状态,但我们将在推理中使用它们。
解码器\u lstm=lstm(潜在\u dim,返回\u序列=True,返回\u状态=True)
解码器输出,解码器输入,
初始状态=编码器状态)
解码器\u密集=密集(num\u解码器\u令牌,activation='softmax')#