Skip to content

Commit

Permalink
don't clone unnecessarily
Browse files Browse the repository at this point in the history
  • Loading branch information
ClashLuke committed Dec 15, 2024
1 parent df96188 commit 6a41b09
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions heavyball/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,6 @@ def compute_ggt(grad, GG, max_precond_dim, precondition_1d, beta):
def promote(x):
if isinstance(x, torch.dtype) and x in (torch.bfloat16, torch.float16):
return torch.float32
if isinstance(x, Tensor):
x = x.clone()
if isinstance(x, Tensor) and x.dtype in (torch.bfloat16, torch.float16):
return x.float()
return x
Expand Down

0 comments on commit 6a41b09

Please sign in to comment.