Skip to content

Conversation

Linux-cpp-lisp
Copy link
Collaborator

No description provided.

@Linux-cpp-lisp Linux-cpp-lisp marked this pull request as draft January 21, 2022 19:48
@Linux-cpp-lisp Linux-cpp-lisp marked this pull request as ready for review February 2, 2022 18:10
Comment on lines 320 to 334
def accumulate_state(self, state: Tuple[torch.Tensor, ...]) -> None:
""" """
n, state = state
N_to_add = len(n) - self.n_bins
if N_to_add > 0:
self._expand_state(N_to_add)
elif N_to_add < 0:
# need to expand the parameter state
n = _pad_dim0(n, -N_to_add)
state = _pad_dim0(state, -N_to_add)
self._state += n * (state - self._state) / (self._n + n)
self._n += n
# Make div by zero 0
self._state = torch.nan_to_num_(self._state, nan=0.0)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost the same as accumulate_batch. So is it for the horovod interface?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants