You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First result: [tensor([[1, 0], [0, 0]]), tensor([[1, 0], [0, 0]])]
Second result: [tensor([[1, 0], [0, 0]]), tensor([[1, 0], [0, 0]])]
The old output is returned even after resetting and entering new data. If the fist metric computation is omitted, the second metric is as expected.
Importantly, this bug only occurs when using forward() to enter data, while update() works as expected.
Expected behavior
The result of the second computation should be independent of the first. Furthermore, forward and update should produce the same state as specified in the docs.
🐛 Bug
Calling
MultioutputWrapper.compute()
afterMultioutputWrapper.reset()
returns old metrics that should have been cleared by the reset.To Reproduce
Code sample
Output:
The old output is returned even after resetting and entering new data. If the fist metric computation is omitted, the second metric is as expected.
Importantly, this bug only occurs when using
forward()
to enter data, whileupdate()
works as expected.Expected behavior
The result of the second computation should be independent of the first. Furthermore, forward and update should produce the same state as specified in the docs.
Environment
Attempts to fix
Adding
super().reset()
(as done in e.g. the minmax wrapper) at the top of the reset method seems to fix the bug.https://github.com/Lightning-AI/metrics/blob/7b505ff1a3b88181bef2b0cdfa21ec593dcda3ff/src/torchmetrics/wrappers/multioutput.py#L133
The text was updated successfully, but these errors were encountered: