Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.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
Tensorflow LSTM变分自动编码器中如何将潜在矢量传递给解码器_Tensorflow_Machine Learning_Deep Learning_Lstm_Autoencoder - Fatal编程技术网

Tensorflow LSTM变分自动编码器中如何将潜在矢量传递给解码器

Tensorflow LSTM变分自动编码器中如何将潜在矢量传递给解码器,tensorflow,machine-learning,deep-learning,lstm,autoencoder,Tensorflow,Machine Learning,Deep Learning,Lstm,Autoencoder,我正在尝试为文本编写自己的LSTM变分自动编码器,并且对编码步骤的工作原理以及如何对潜在向量Z进行采样有了很好的理解。现在的问题是如何将Z传递给解码器。对于解码器的输入,我有一个开始标记,它保留解码器中LSTM单元的隐藏状态h,单元状态c 我应该使初始状态h和c都等于Z,只是其中一个,还是其他什么 使用,您可以重复潜在输出n次。然后,将其输入LSTM。下面是一个简单的例子: # latent_dim: int, latent z-layer shape. decoder_input = I

我正在尝试为文本编写自己的LSTM变分自动编码器,并且对编码步骤的工作原理以及如何对潜在向量
Z
进行采样有了很好的理解。现在的问题是如何将
Z
传递给解码器。对于解码器的输入,我有一个开始标记
,它保留解码器中LSTM单元的隐藏状态
h
,单元状态
c

我应该使初始状态
h
c
都等于
Z
,只是其中一个,还是其他什么

使用,您可以重复潜在输出
n
次。然后,将其输入LSTM。下面是一个简单的例子:

 # latent_dim: int, latent z-layer shape. 
 decoder_input = Input(shape=(latent_dim,)) 

 _h_decoded = RepeatVector(timesteps)(decoder_input)
 decoder_h = LSTM(intermediate_dim, return_sequences=True)
 _h_decoded = decoder_h(_h_decoded)

 decoder_mean = LSTM(input_dim, return_sequences=True)
 _x_decoded_mean = decoder_mean(_h_decoded)

 decoder = Model(decoder_input, _x_decoded_mean)

关于您的答案,请参见。

Thx。但据我所知,当使用VAE生成文本时,您希望将LSTM的输出作为输入反馈,基本上消除了将
Z
用作输入的可能性,这就是您的示例所显示的?@Covey LSTM的输出与输入进行比较,错误通过网络反向传播。