在Trax文档中,用于Trax.layers.attention.ShiftRight(https://trax-ml.readthedocs.io/en/latest/trax.layers.html?highlight=tl.ShiftRight#trax.layers.attention.ShiftRight),上面写着“仅当图层以非‘val’模式创建时才适用。”
有三种模式:“train”、“eval”和“predict”在我的理解中,tl.ShiftRight会插入一个零来表示这是一个句子的开头。我不知道为什么它不适用于“eval”模式。
我想在每种模式下,都有必要插入一个零标记来表示句子的开头。