karpathy / nn-zero-to-hero

Neural Networks: Zero to Hero
MIT License
10.9k stars 1.33k forks source link

Error in makemore_part1_bigrams.ipynb #37

Open mksamelson opened 1 year ago

mksamelson commented 1 year ago

P.shape


NameError Traceback (most recent call last) in <cell line: 1>() ----> 1 P.shape

NameError: name 'P' is not defined

jingairpi commented 6 months ago

P is just a normalization version of N for probability.

You can easily fix it by

P = N.float()
P = P / P.sum(1, keepdim=True)