-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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 tensor printing in trainer.test()
#5138
Conversation
trainer.test()
Codecov Report
@@ Coverage Diff @@
## master #5138 +/- ##
======================================
Coverage 93% 93%
======================================
Files 135 135
Lines 10023 10023
======================================
Hits 9356 9356
Misses 667 667 |
pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py
Outdated
Show resolved
Hide resolved
…onnector.py Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Hello @bryant1410! Thanks for updating this PR. There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-01-25 05:32:33 UTC |
pprint({k: (v.item() if v.numel() == 1 else v.tolist()) if isinstance(v, torch.Tensor) else v | ||
for k, v in results.items()}) |
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.
Just thinking if it is worth to actually do our own pprint (extend the existing one), that does this kind of unwrapping for tensors so that we can simply reuse this one (also nice for user)
well, shall this be rather a feature? |
* Fix showing test results for tensors * Fix docs * Update pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py Co-authored-by: Nicki Skafte <skaftenicki@gmail.com> * Fix lint issues Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
* Fix showing test results for tensors * Fix docs * Update pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py Co-authored-by: Nicki Skafte <skaftenicki@gmail.com> * Fix lint issues Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
* Fix showing test results for tensors * Fix docs * Update pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py Co-authored-by: Nicki Skafte <skaftenicki@gmail.com> * Fix lint issues Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
* Fix showing test results for tensors * Fix docs * Update pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py Co-authored-by: Nicki Skafte <skaftenicki@gmail.com> * Fix lint issues Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
* Fix showing test results for tensors * Fix docs * Update pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py Co-authored-by: Nicki Skafte <skaftenicki@gmail.com> * Fix lint issues Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
What does this PR do?
Fix printing tensors when showing test results, so it goes from this
to this
Fixes #5107
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃