Hi,
In general, you should not use .data as it is very unlikely to do what you want.
If you want to specify the backward corresponding to a given function, you can create a custom autograd.Function as described in the doc here: https://pytorch.org/docs/stable/notes/extending.html#extending-torch-autograd 15