【问题标题】:The positional encoding in official transformer's release is different from the original paperTransformer 官方发布的位置编码与原论文不同
【发布时间】:2018-11-29 13:21:43
【问题描述】:

在原论文Attention is all you need中,位置编码定义为: pe

但是在Transformer's model_utils.py中,我发现第53行的公式不同。在论文中,sincos函数按偶数或单维交替出现,而它们在一半连续分别是维度。

【问题讨论】:

    标签: python tensorflow transformer


    【解决方案1】:

    你是对的,但我不认为这有什么不同。无论您将sin/cos 连接起来还是让它们交替出现在最终的向量中,使用位置编码的每个位置的表示都是唯一的。

    只要编码是唯一的并且我们始终一致地生成编码,位置信息就会保留在模型中。

    【讨论】:

      猜你喜欢
      • 2020-08-16
      • 2021-08-27
      • 2021-08-14
      • 2020-04-14
      • 1970-01-01
      • 2020-08-09
      • 1970-01-01
      • 2016-12-10
      • 2012-03-02
      相关资源
      最近更新 更多