Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 25, 2024
1 parent fbf6d86 commit 858eed4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deepmd/pt/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ def dict_to_device(sample_dict):
if isinstance(sample_dict[key], list):
sample_dict[key] = [item.to(DEVICE) for item in sample_dict[key]]
if isinstance(sample_dict[key], np.float32):
sample_dict[key] = torch.ones(1, dtype=torch.float64, device=DEVICE) * sample_dict[key]
sample_dict[key] = (

Check warning on line 120 in deepmd/pt/utils/utils.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/utils/utils.py#L119-L120

Added lines #L119 - L120 were not covered by tests
torch.ones(1, dtype=torch.float64, device=DEVICE) * sample_dict[key]
)
else:
if sample_dict[key] is not None:
sample_dict[key] = sample_dict[key].to(DEVICE)

0 comments on commit 858eed4

Please sign in to comment.