Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于shuffle操作代码的疑问 #6

Open
endaoguansanlu opened this issue Sep 13, 2022 · 0 comments
Open

关于shuffle操作代码的疑问 #6

endaoguansanlu opened this issue Sep 13, 2022 · 0 comments

Comments

@endaoguansanlu
Copy link

您好,请问在模型实现代码中为什么只需要换一下ws1和hh、ws2和ww的位置就能实现shuffle的操作呢,在括号里相乘(AxB)和(BxA)应该没有什么区别吧,期待您的解答!

就是下面的代码
q, k, v = rearrange(qkv, 'b (qkv h d) (ws1 hh) (ws2 ww) -> qkv (b hh ww) h (ws1 ws2) d', h=self.num_heads, qkv=3, ws1=self.ws, ws2=self.ws)
q, k, v = rearrange(qkv, 'b (qkv h d) (hh ws1) (ww ws2) -> qkv (b hh ww) h (ws1 ws2) d', h=self.num_heads, qkv=3, ws1=self.ws, ws2=self.ws)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant