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
Based on this thread it seems as if the internal members of the class hold references to the tensors, thus yielding wrong results.
When the tensor value is passed by .item() the result is correct.
A simple fix would be to add this condition to add:
Thanks for reporting this, and I agree that this is caused by the internal members holding references.
AverageValueMeter is spec'ed to support tensors and numpy arrays element-wise. So the correct output for the thread that you linked should be Tensor([[10.]]) (like a single-pixel image). Supporting tensors like this is desirable if, for example, you wanted to get the mean image in a dataset in order to whiten the inputs.
I think that an earlier contribution broke this tensor-supporting behavior (understandable, because I neither documented the specifications nor added tests!).
I just pushed a fix and a couple tests to fix the bug. Any documentation or other improvements would be most welcome. Thanks again for posting the issue!
Based on this thread it seems as if the internal members of the class hold references to the
tensors
, thus yielding wrong results.When the
tensor
value is passed by.item()
the result is correct.A simple fix would be to add this condition to
add
:I can submit a PR, if that makes sense to you.
The text was updated successfully, but these errors were encountered: