-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
29 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,7 +169,7 @@ def _test_corr_mean_func(rank, world_size, tempfile_name, test_case): | |
in_data = Tensor(in_data[rank]).cuda() | ||
out = model(in_data) | ||
out.sum().backward() | ||
results.append(optim._compute_intra_grad_corr_mean()) | ||
results.append(optim._compute_intra_grad_corr_mean().item()) | ||
# sync gradients manually | ||
for p in model.parameters(): | ||
if p.grad is not None: | ||
|
@@ -191,6 +191,10 @@ def _test_corr_mean_func(rank, world_size, tempfile_name, test_case): | |
|
||
|
||
@skip_if_single_gpu | ||
@pytest.mark.skipif( | ||
torch.__version__.split("+")[0].split(".") < ["1", "10", "0"], | ||
This comment has been minimized.
Sorry, something went wrong.
min-xu-ai
Contributor
|
||
reason="torch.corrcoef available only for torch 1.10 or higher", | ||
) | ||
def test_corr_mean(): | ||
""" | ||
Test _compute_intra_grad_corr_mean and _gather_flat_grad using ddp.no_sync() | ||
|
this could be a local (nested) function within _gather_flat_grad? It doesn't use self anyway, right?