Solved by tom in post #2 
              
              
                These blogposts should really use torch.ones_like(loss) (but only for scalar-valued loss) even when ignoring the memory layout to keep things simple. torch.autograd.backward will call an auxiliary function 
_make_grads that creates those if they are not passed in. 
Having a None formal default argum…