Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4bde2eb
Fix sync_all_reduce
sadra-barikbin Dec 21, 2022
f174e7d
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Jan 4, 2023
83dd16e
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Jan 5, 2023
f9970d3
Make _is_reduced no-op, add a test and a little improvement
sadra-barikbin Jan 6, 2023
f5b434e
Make _is_reduced no-op, add a test and a little improvement
sadra-barikbin Jan 6, 2023
1bf75bb
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Jan 11, 2023
2f0d9a6
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Jan 11, 2023
ea2474e
Fix Mypy
sadra-barikbin Jan 11, 2023
74515fe
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Jan 18, 2023
319f0f6
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
vfdev-5 Feb 1, 2023
392a191
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Feb 15, 2023
cdc7e5a
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Feb 16, 2023
ca391f9
Remove some asserts from test_loss & test_accuracy
sadra-barikbin Feb 16, 2023
fb8b431
Fix bug
sadra-barikbin Feb 16, 2023
4687414
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Feb 16, 2023
6ba844f
Remove _is_reduced
sadra-barikbin Feb 16, 2023
086fa72
Merge remote-tracking branch 'upstream/Fix-sync_all_reduce-decorator-…
sadra-barikbin Feb 16, 2023
2c0d020
Revert deleted assertions
sadra-barikbin Feb 16, 2023
67d0833
Fix a bug in precision
sadra-barikbin Feb 16, 2023
c048119
Fix a mypy error
sadra-barikbin Feb 16, 2023
3017b8e
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Feb 16, 2023
3c0f305
Update ignite/metrics/metric.py
sadra-barikbin Feb 17, 2023
20690af
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Feb 17, 2023
c9f474e
Revert a change in test_accuracy
sadra-barikbin Feb 17, 2023
ac95fa5
Merge branch 'master' into Fix-sync_all_reduce-decorator-to-consider-…
sadra-barikbin Feb 17, 2023
af380f5
Revert a change in test_accuracy exactly
sadra-barikbin Feb 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ignite/metrics/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,10 @@ def another_wrapper(self: Metric, *args: Any, **kwargs: Any) -> Callable:
f"number or tensor but `{attr}` has type {type(t)}"
)
unreduced_attrs[attr] = t
# Here `clone` is necessary since `idist.all_reduce` modifies `t` inplace in the case
# Here `clone` is necessary since `idist.all_reduce` modifies `t` inp-lace in the case
# `t` is a tensor and its `device` is same as that of the process.
# TODO: Remove this dual behavior of `all_reduce` to always either return a new tensor or
# modify it in-place.
t_reduced = idist.all_reduce(cast(float, t) if isinstance(t, Number) else t.clone(), **op_kwargs)
setattr(self, attr, t_reduced)

Expand Down
2 changes: 1 addition & 1 deletion ignite/metrics/precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def compute(self) -> Union[torch.Tensor, float]:
fraction = self._numerator / (self._denominator + (self.eps if self._average != "samples" else 0))

if self._average == "weighted":
_weight = idist.all_reduce(self._weight)
_weight = idist.all_reduce(self._weight.clone())
sum_of_weights = cast(torch.Tensor, _weight).sum() + self.eps
return ((fraction @ _weight) / sum_of_weights).item() # type: ignore
elif self._average == "micro" or self._average == "samples":
Expand Down