Skip to content

Commit

Permalink
Remove unnecessary copy of gradients in util (#144329)
Browse files Browse the repository at this point in the history
Summary:
No need to copy gradients to CPU too

X-link: pytorch/pytorch#144329
Approved by: https://github.com/awgu, https://github.com/cyyever

Reviewed By: clee2000

Differential Revision: D67943148

fbshipit-source-id: dea67477dbc0a791cf4a8c72ca7c9e4d4381cc54
  • Loading branch information
Skylion007 authored and facebook-github-bot committed Jan 8, 2025
1 parent 31cc1a4 commit d15a3cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2492,7 +2492,7 @@ def to_tensor(t):
return True
score = torch.nn.functional.cosine_similarity(ref, res, dim=0, eps=1e-6)
if score < 0.99:
log.warning("Similarity score=%s", score.cpu().detach().item())
log.warning("Similarity score=%s", score.detach().cpu().item())
return score >= 0.99
else:
if not exact_dtype:
Expand Down

0 comments on commit d15a3cc

Please sign in to comment.