var1 and var2 have no grad_fn because you are not performing any operation that changes their values.
I believe that the conv1 weight doesn’t have a grad_fn because some_function() (or any python function) returns the value rather than the reference. So although the value gets updated, the lack of reference means Pytorch can’t know what changed the value.