Hi,
The problem most likely comes from the fact that you use old style Functions. You can see in the doc 116 how to write new style ones.
Do keep the .clone() in the forward though otherwise we detect that it’s the same Tensor and the Function's backward won’t be called.