【发布时间】:2020-11-26 02:08:29
【问题描述】:
我正在尝试使用以下教程 https://www.tensorflow.org/tutorials/text/nmt_with_attention 了解注意力模型
在解码器部分是这样写的:
# x shape after passing through embedding == (batch_size, 1, embedding_dim)
x = self.embedding(x)
我不明白为什么嵌入输出是 (batch_size, 1, embedding_dim)。根据文档(https://www.tensorflow.org/api_docs/python/tf/keras/layers/Embedding),输出必须是(batch_size, input_length, output_dim),在教程的情况下是(batch_size, max_len,embedding_dim)。
问题:为什么seccode维度=1,而不是max_len?
【问题讨论】: