Skip to content

Commit

Permalink
add a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kzkadc committed Apr 8, 2024
1 parent d6b2ee6 commit b1cc792
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ignite/metrics/mutual_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def reset(self) -> None:

def _update(self, prob: torch.Tensor, log_prob: torch.Tensor) -> None:
super()._update(prob, log_prob)
# We can't use += below as _sum_of_probabilities can be a scalar and prob.sum(dim=0) is a vector
self._sum_of_probabilities = self._sum_of_probabilities + prob.sum(dim=0).to(self._device)

@sync_all_reduce("_sum_of_probabilities")
Expand Down

0 comments on commit b1cc792

Please sign in to comment.