For this, you need to delete the class EigvalshGrad, and make guilld the graph in the method Eigvalsh.grad() instead of returning EigvalshGrad. A perform method, work on ndarray. The grad() method work on symbolic variable.