Pretty sure a variable’s .grad member is only non-None after backproping some gradient to it. I.e., you need call .backward() in order for the variables in a given subgraph to have non-None .grad members