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

No keepdim in dbnmeani calculation in makemore_part4_backprop.ipynb #59

Open
troeshust opened this issue Jul 7, 2024 · 0 comments · May be fixed by #68
Open

No keepdim in dbnmeani calculation in makemore_part4_backprop.ipynb #59

troeshust opened this issue Jul 7, 2024 · 0 comments · May be fixed by #68

Comments

@troeshust
Copy link

In the notebook makemore_part4_backprop.ipynb, there is a small issue with the calculation of dbnmeani in the following line:

dbnmeani = (-dbndiff).sum(0)

This should be corrected to:

dbnmeani = (-dbndiff).sum(0, keepdim=True)

The current implementation without keepdim results in dbnmeani.shape being [64], whereas bnmeani.grad.shape is [1, 64]. While for cmp() torch.tensor([1, 2, 3]) with shape [3] is equivalent to torch.tensor([[1, 2, 3]]) with shape [1, 3], the lack of keepdim here can cause confusion due to the shape mismatch.

conscell added a commit to conscell/nn-zero-to-hero that referenced this issue Dec 27, 2024
Fixes karpathy#59: Corrected the shape of `dbnmeani`, which should be [1, 64] instead of [64].
@conscell conscell linked a pull request Dec 27, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant