You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many thanks for reporting this! In fact, we should make maximum use of the native attention mechanism.
During the implementation of this class, we conducted extensive experimentation to understand the rationale behind why these small details significantly impacted performance.
Since our tests didn't reveal the exact root cause that you identified, we left it as is. I remember we were very curious about this issue, and even @martinwimpff conducted a more systematic study on it, but again, without a conclusion. We can definitely revive this question to remove as much code as possible :)
+1 to use native pytorch code. Here it seems more like a bug report. If the data does not allow to conclude as error bars are too big due to limited data let's just do what the theory / common practice suggests !
I agree with @agramfort. Even though we might sacrifice some performance/reproducability (on the reported datasets), there is no reason to build custom attention layers like this without a clear justification of the differences to the original implementation.
@martinwimpff, can you share here the code that you showed me once, with all the key components that you studied to match the value for the multiattention? I recall that initialization was a crucial step.
Activity
bruAristimunha commentedon Dec 17, 2025
hey @Leob000 :)
Many thanks for reporting this! In fact, we should make maximum use of the native attention mechanism.
During the implementation of this class, we conducted extensive experimentation to understand the rationale behind why these small details significantly impacted performance.
#454 (comment)
Since our tests didn't reveal the exact root cause that you identified, we left it as is. I remember we were very curious about this issue, and even @martinwimpff conducted a more systematic study on it, but again, without a conclusion. We can definitely revive this question to remove as much code as possible :)
agramfort commentedon Dec 17, 2025
+1 to use native pytorch code. Here it seems more like a bug report. If the data does not allow to conclude as error bars are too big due to limited data let's just do what the theory / common practice suggests !
martinwimpff commentedon Dec 17, 2025
I agree with @agramfort. Even though we might sacrifice some performance/reproducability (on the reported datasets), there is no reason to build custom attention layers like this without a clear justification of the differences to the original implementation.
bruAristimunha commentedon Dec 17, 2025
hey @Leob000,
Looks like we have your first official braindecode PR coming! Now it's no longer the case study for the internship :)
And to start well with @agramfort and @martinwimpff reviewing ;)
@martinwimpff, can you share here the code that you showed me once, with all the key components that you studied to match the value for the multiattention? I recall that initialization was a crucial step.
refactor: Use F.scaled_dot_product_attention in MultiHeadAttention
refactor: Use F.scaled_dot_product_attention in MultiHeadAttention
refactor: Use F.scaled_dot_product_attention in MultiHeadAttention
refactor: Use F.scaled_dot_product_attention in MultiHeadAttention
refactor: Use F.scaled_dot_product_attention in MultiHeadAttention
refactor: Use F.scaled_dot_product_attention in MultiHeadAttention