Luis:

h.sqrt(torch.pow(doutdx, 2) + torch.pow(doutdy, 2))


Yes!
I replaced
dout = torch.sqrt(torch.pow(doutdx, 2) + torch.pow(doutdy, 2))
by
dout = (torch.pow(doutdx, 2) + torch.pow(doutdy, 2))
and now it seems to compute the backprojection fine! By removing the sqrt we do not lose the edge detection semantic, but now I am curious to understand why it is happening.
Do you have any idea?