karpathy/nn-zero-to-hero

makemore/lecture4/backprop/dC

we89 opened this issue · 2 comments

we89 commented
dC = torch.zeros_like(C)
for k in range(Xb.shape[0]):
    dC[Xb[k]] += demb[k]

I don't know why it is `wrong.
And the correct answer is:

dC = torch.zeros_like(C)
for k in range(Xb.shape[0]):
    for j in range(Xb.shape[1]):
        ix = Xb[k,j]
        dC[ix] += demb[k,j]

What is your question. Can you elaborate more clearly ?