Hi, Thomas
It’s  much detailed.
You don’t return anything from the backward, though, and it you might have funny side effects if you use backward that propagates to portions of the graph outside the function’s variables in your Function.
For this case, I am not sure whether this meets the expectation.
def run3():
    class my_function(autograd.Function):
        @staticmethod
        def forward(ctx, x):
            ctx.save_for_backward(x)
            return x

        @staticmethod
        def backward(ctx, grad_output):
            (x,) = ctx.saved_tensors
            print('x.requires_grad', x.requires_grad)
            x_clone = x.clone().detach().requires_grad(True)
            aux_loss = x_clone.sum()
            aux_loss.backward()

            return grad_output + x_clone.grad()