如何解决如何在pytorch注意模块中为Query制作非方形权重矩阵?
这个问题的续集。 Why W_q matrix in torch.nn.MultiheadAttention is quadratic
在注意力模块中,我希望 Query 的权重投影矩阵是 非方 矩阵 (m-by-n for which m ≠ n) 。就像 Jay Alammar 所解释的那样。 http://jalammar.github.io/illustrated-transformer/
查看附加图片。
但是,pytorch 实现似乎只有一个带有 embed_dim x embed_dim 的方阵。 https://pytorch.org/docs/stable/_modules/torch/nn/modules/activation.html#MultiheadAttention
无论如何在pytorch中设置embed_dim1 x embed_dim2?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。