Fix MHAEinsum weight dimension bug when d_in != d_out (#857) (#893)

* Fix MHAEinsum weight dimension bug when d_in != d_out (#857)

Previously MHAEinsum initialized weight matrices with shape (d_out, d_in) and used inappropriate einsum notation, causing failures for non-square input-output dimensions. This commit corrects weight initialization to shape (d_in, d_out), updates einsum notation to 'bnd,do->bno', and adds three unit tests to verify parity across different d_in and d_out settings. All tests pass successfully.

* use pytest

* Update .gitignore

---------

Co-authored-by: rasbt <mail@sebastianraschka.com>
This commit is contained in:
Aviral Garg
2025-11-01 08:15:31 +05:30
committed by GitHub
parent b1db33b384
commit 27d52d6378
4 changed files with 80 additions and 14 deletions

2
.gitignore vendored
View File

@@ -328,3 +328,5 @@ cython_debug/
# pixi environments
.pixi
*.egg-info