it can be correct but doesn’t make much sense to me, that you’re tying to matmul. you have to at least start from the original formula (IIRC, rhs_grad_output = grad_output @ args[0].t()) if you have a reason to have such a Function.