-
Notifications
You must be signed in to change notification settings - Fork 615
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
Fix logging trace statement with empty gradient_fn #4669
Conversation
[sc-47564] |
Hello. You may have forgotten to update the changelog!
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4669 +/- ##
==========================================
- Coverage 99.64% 99.63% -0.01%
==========================================
Files 377 377
Lines 34002 33741 -261
==========================================
- Hits 33881 33619 -262
- Misses 121 122 +1
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I totally get what's being handled here. I thought it was the difference when gradient_fn
is None, but they seem the same?
>>> def fn1():
... return 2
>>> fn2 = None
>>> print(isfunction(fn1), isfunction(fn2))
True False
>>> print(callable(fn1), callable(fn2))
True False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think some minimal testing would be good, since this was never caught by CI, otherwise looks good!
Did you enable the trace logging level? This config requires explicit edits to the YAML file at
I see failures without this, and success with. |
Testing with the previous logging contribution wasn't easily possible, so this will likely need to be skipped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
talked offline, looks good 👍
Before submitting
Please complete the following checklist when submitting a PR:
All new features must include a unit test.
If you've fixed a bug or added code that should be tested, add a test to the
test directory!
All new functions and code must be clearly commented and documented.
If you do make documentation changes, make sure that the docs build and
render correctly by running
make docs
.Ensure that the test suite passes, by running
make test
.Add a new entry to the
doc/releases/changelog-dev.md
file, summarizing thechange, and including a link back to the PR.
The PennyLane source code conforms to
PEP8 standards.
We check all of our code against Pylint.
To lint modified files, simply
pip install pylint
, and thenrun
pylint pennylane/path/to/file.py
.When all the above are checked, delete everything above the dashed
line and fill in the pull request template.
Context: The logging implementation for the TRACE level assumes the existence of several functions to report their source when enabled. If the gradient_fn is None, the logger attempts to retrieve the source and fails.
Description of the Change: This adds an existence check for all execute-enabled TRACE level log statements, and reports only if the associated functions exist.
Benefits:
Possible Drawbacks:
Related GitHub Issues: