-
-
Notifications
You must be signed in to change notification settings - Fork 657
Removed wrong docstrings for Metric update method's input type #2849
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
Removed wrong docstrings for Metric update method's input type #2849
Conversation
…Metric update method's input type
vfdev-5
left a comment
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 for the PR @sallycaoyu
I left few comments. There is a difference in supported types between Metric.update and Metric.iteration_completed. As Engine's output goes first into Metric.iteration_completed which can handle dicts into tuple and pass this tuple into Metric.update. Seems like this is the source of the confusion... I understand that this is not ideal but I'm not what would be the best to fix that.
|
Thank you @vfdev-5 for the explanation! For now, I have made another commit to revert the changes except for the ones only for For future improvements to this issue, I think one way would be to keep the code as-is and add more details for the docstring
...to explain how
Another way would be to change the code implementation, which I am still considering how to do. One way I could think of is to handle the dicts in the base Metric class instead of in
and other child classes can either run |
@sallycaoyu I agree on updating docs. Thanks for the updates ! |
vfdev-5
left a comment
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.
LGTM, thanks @sallycaoyu !
Fixes #2054
Description:
Removed input form
{'y_pred': y_pred, 'y': y, ...}from docstrings and fromdocs/source/metrics.rstfor theignite.Metric.updatemethods as Wrong docstrings for Metricupdatemethod's input type #2054 suggested, since the code does not support this input form.Added descriptions of update method's accepted input form and
output_transform's usage in docstrings forignite.Metric.PSNRandignite.Metric.SSIM.Fixed a bug in ignite.metric.metric.py's CustomMetric example (line 172).
Question: There exist two types of function signatures for update methods that take
(y_pred, y)as their inputs:def update(self, output: Sequence[torch.Tensor]) -> None:, anddef update(self, output: Tuple[torch.Tensor, torch.Tensor]) -> None:(in EpochMetric)Should this be made consistent somehow? I think the first option would allow users to pass either a
tupleor alistas the input, whereas the second option will ask the input to stick to thetupletype.Check list: