@@ -346,7 +346,7 @@ def infer_shape(self, fgraph, node, shapes):
346346
347347 return [(n ,), (n , n )]
348348
349- def L_op (self , inputs , outputs , grad_outputs ):
349+ def L_op (self , inputs , outputs , output_grads ):
350350 raise NotImplementedError (
351351 "Gradients for Eig is not implemented because it always returns complex values, "
352352 "for which autodiff is not yet supported in PyTensor (PRs welcome :) ).\n "
@@ -404,7 +404,7 @@ def perform(self, node, inputs, outputs):
404404 (w , v ) = outputs
405405 w [0 ], v [0 ] = np .linalg .eigh (x , self .UPLO )
406406
407- def grad (self , inputs , g_outputs ):
407+ def L_op (self , inputs , outputs , output_grads ):
408408 r"""The gradient function should return
409409
410410 .. math:: \sum_n\left(W_n\frac{\partial\,w_n}
@@ -428,10 +428,9 @@ def grad(self, inputs, g_outputs):
428428
429429 """
430430 (x ,) = inputs
431- w , v = self (x )
432- # Replace gradients wrt disconnected variables with
433- # zeros. This is a work-around for issue #1063.
434- gw , gv = _zero_disconnected ([w , v ], g_outputs )
431+ w , v = outputs
432+ gw , gv = _zero_disconnected ([w , v ], output_grads )
433+
435434 return [EighGrad (self .UPLO )(x , w , v , gw , gv )]
436435
437436
0 commit comments