mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE]: Remove unnecessary copy of gradients in util (#144329)
No need to copy gradients to CPU too Pull Request resolved: https://github.com/pytorch/pytorch/pull/144329 Approved by: https://github.com/awgu, https://github.com/cyyever
This commit is contained in:
committed by
PyTorch MergeBot
parent
e14c36d3f4
commit
373541fbf4
@ -2492,7 +2492,7 @@ def same(
|
||||
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:
|
||||
|
Reference in New Issue
Block a user