Skip to content

Commit

Permalink
debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
cw-tan committed Sep 18, 2024
1 parent 6598ab8 commit 6c926d7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/unittests/bases/test_ddp.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ def _test_ddp_gather_autograd_different_shape(rank: int, worldsize: int = NUM_PR
scalar2 = scalar2 + torch.sum(result[idx] * torch.ones_like(result[idx]))
gradient1 = torch.autograd.grad(scalar1, [tensor], retain_graph=True)[0]
gradient2 = torch.autograd.grad(scalar2, [tensor])[0]
print("shapes", gradient1.shape, gradient2.shape)
print("g1", gradient1)
print("g2", gradient2)
print("diff", gradient1 - gradient2)
assert torch.allclose(gradient1, gradient2)


Expand Down

0 comments on commit 6c926d7

Please sign in to comment.