注意力权重attn_output_weights形状还是(N⋅num\_heads,L,S),依然会在第0维度进行广播机制扩展。3....
使用到掩码的第2个地方便是Padding Mask。由于在网络的训练过程中同一个batch会包含有多个文本序列,而...
target维度key_padding_mask=einops.repeat(key_padding_mask,"batch num_heads tag src_len->batch (...
就是src,出现在decoder,就是tgt,decoder每个block的第二层和encoder做cross attention的时候,就是memor...