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

Conjugate Transpose Operation On Key matrix #15

Open
zhey16 opened this issue Oct 5, 2023 · 1 comment
Open

Conjugate Transpose Operation On Key matrix #15

zhey16 opened this issue Oct 5, 2023 · 1 comment

Comments

@zhey16
Copy link

zhey16 commented Oct 5, 2023

Hi, we noticed that in the paper you mentioned conjugate transpose operation when computing element-wise product between key and query. But we did not see this operation in this line

And since the conjugate transpose will also change the shape of the matrix, wouldn't this operation affect the element-wise product?

So it is quiet confusing about how you apply this operation. Can you give us some insights about this? Thanks!

@kkkls
Copy link
Owner

kkkls commented Nov 24, 2023

I'm sorry for replying so late. Actually, the size of the features before and after the FFT operation remains the same. For a tensor of size hw, after the FFT operation, the shape will become h(w/2+1) due to the conjugate symmetry property of the FFT. In the specific implementation, this reason is taken into consideration, and we do not perform a transpose operation (which would introduce unnecessary complications). As for the conjugate operation, you can use torch.conj() to implement it. In our experiments, the conjugate operation did not have any impact on the final results, so we ultimately did not use it.

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

2 participants