Skip to content

Commit

Permalink
reuse PRECISION_DICT
Browse files Browse the repository at this point in the history
  • Loading branch information
njzjz authored Feb 4, 2024
1 parent 7afe438 commit 098f02b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions deepmd/pt/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
set_default_nthreads,
)

numpy_to_torch_dtype_dict = {
np.float16: torch.float16,
np.float32: torch.float32,
np.float64: torch.float64,
}

GLOBAL_PT_FLOAT_PRECISION = numpy_to_torch_dtype_dict[GLOBAL_NP_FLOAT_PRECISION]
SAMPLER_RECORD = os.environ.get("SAMPLER_RECORD", False)
try:
# only linux
Expand Down Expand Up @@ -48,6 +41,7 @@
"int32": torch.int32,
"int64": torch.int64,
}
GLOBAL_PT_FLOAT_PRECISION = PRECISION_DICT[np.dtype(GLOBAL_NP_FLOAT_PRECISION).name]

Check warning on line 44 in deepmd/pt/utils/env.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/utils/env.py#L44

Added line #L44 was not covered by tests
DEFAULT_PRECISION = "float64"

# throw warnings if threads not set
Expand Down

0 comments on commit 098f02b

Please sign in to comment.