Skip to content

Grad error message #721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 17 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pytensor/graph/op.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import pytensor
from pytensor.configdefaults import config
from pytensor.gradient import grad_not_implemented
from pytensor.graph.basic import Apply, Variable
from pytensor.graph.utils import (
MetaObject,
Expand Down Expand Up @@ -357,7 +358,10 @@ def grad(
.. [1] Giles, Mike. 2008. “An Extended Collection of Matrix Derivative Results for Forward and Reverse Mode Automatic Differentiation.”

"""
raise NotImplementedError()
# raise NotImplementedError()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my suggestion for a simpler solution

Suggested change
# raise NotImplementedError()
raise NotImplementedError(f"grad not implemented for Op {self}")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also your implementation was wrong because it assumed there is a single input

(a,) = inputs
a_grad = grad_not_implemented(self, 0, a, comment="To be updated")
return [a_grad]

def L_op(
self,
Expand Down