neuroprob/utils/pytorch.py
def _Gv(self, loss, output, vec, damping):
        """
        Computes the generalized Gauss-Newton vector product.
        """
        Jv = self._Rop(output, self._params, vec)

        gradient = torch.autograd.grad(loss, output, create_graph=True)
        HJv = self._Rop(gradient, output, Jv)

        JHJv = torch.autograd.grad(
            output, self._params, grad_outputs=HJv.reshape_as(output), retain_graph=True)

        # Tikhonov damping (Section 20.8.1)
        return parameters_to_vector(JHJv).detach() + damping * vec

        Computes the generalized Gauss-Newton vector product.
        
Computes the generalized Gauss-Newton vector product.
Computes the generalized Gauss - Newton vector product .
def _Gv(self, loss, output, vec, damping):
        Jv = self._Rop(output, self._params, vec)
        gradient = torch.autograd.grad(loss, output, create_graph=True)
        HJv = self._Rop(gradient, output, Jv)
        JHJv = torch.autograd.grad(
            output, self._params, grad_outputs=HJv.reshape_as(output), retain_graph=True)
        return parameters_to_vector(JHJv).detach() + damping * vec
def _Gv ( self , loss , output , vec , damping ) : Jv = self . _Rop ( output , self . _params , vec ) gradient = torch . autograd . grad ( loss , output , create_graph = True ) HJv = self . _Rop ( gradient , output , Jv ) JHJv = torch . autograd . grad ( output , self . _params , grad_outputs = HJv . reshape_as ( output ) , retain_graph = True ) return parameters_to_vector ( JHJv ) . detach ( ) + damping * vec
Computes the generalized Gauss-Newton vector product.
Computes the generalized Gauss - Newton vector product .
"""
        Computes the generalized Gauss-Newton vector product.
        """ # Tikhonov damping (Section 20.8.1)
self
loss
output
vec
damping