Hi,
Actually the sum is not there, it’s a matrix product: G * J where J is the Jacobian of the function that given X produced Y.
Unfortunately, this is a limitation of automatic differentiation itself, not pytorch. So you won’t be able to change the jacobian before doing the multiplication with G.