Leockl:

A.requires_grad_()   # what is this doing?
out = my_nullspace(A)



It tells Pytorch that the “A” variable can be part of the optimisation process. In other words, makes it differentiable and updates it in the gradient descend.



 Leockl:

out.sum().backward()   # what is this doing?


It is used as loss function, in general to back prop from the loss function to network weights your loss whatever it is should be differentiatabke and a SCORE measure. For example, loss= value, where value here is just a tensor number.
Hope this helps.