Skip to content
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

Function openvino.core.custom_gradient() should be a class #20953

Open
JulianJvn opened this issue Feb 24, 2025 · 0 comments
Open

Function openvino.core.custom_gradient() should be a class #20953

JulianJvn opened this issue Feb 24, 2025 · 0 comments
Assignees

Comments

@JulianJvn
Copy link

I'm not using this, but I saw by accident while browsing the code that keras.backend.openvino.core.custom_gradient() is a function that defines nested functions __init__() and __call__(), but doesn't do anything (in particular, it seems to return None):

def custom_gradient(fun):
"""Decorator for custom gradients.
Args:
fun: Forward pass function.
"""
def __init__(self, fun):
warnings.warn(
"`custom_gradient` for the openvino backend"
" acts as a pass-through to "
"support the forward pass."
" No gradient computation or modification "
"takes place."
)
self.fun = fun
def __call__(self, *args, **kwargs):
outputs, _ = self.fun(*args, **kwargs)
return outputs

I think line 598 should be

class custom_gradient:

Introduced by 5c401a9 in #19727. It was a function throwing a NotImplementedError before, but should have been changed to a class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants