Hi,
Note that on the python side, the Function have changed slightly as you can see in the tuto 7.
For cpp it is a bit more complex. a Function does only one way and its “apply” method should be implemented. It is either implemented in pure autograd by performing operations on Variables or the output should be wrapped and the backward Function specified.
You will need 2 functions if you want a custom backward. For example here 12, “DelayedError” is the forward function and “Error” is the backward.