Manually calculating the gradient

Hi, I’m going through the autograd tutorial and I’m confused about the first step in calculating the gradient. Why is o = 1/4 ∑z ?

Can someone explain this?


z is of size 2 X 2. So, in total has 4 elements. out = z.mean() is thus the same as (1/4) X Summation over elements of z.

1 Like

Ahhh, of course. Thanks!