Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State reduce #3

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

State reduce #3

wants to merge 8 commits into from

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