Hi,
Well gradient check checks whether the gradients computed in the backward match the derivative of your forward function.
In your case, your backward definitely don’t compute the gradients of the function that corresponds to the forward. So I would expect the gradcheck to fail.
PS: To avoid weird autograd behavior, change your forward() method to return x.clone().