Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions deepmd/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
)

__all__ = [
"GLOBAL_NP_FLOAT_PRECISION",
"VALID_ACTIVATION",
"VALID_PRECISION",
"expand_sys_str",
Expand Down Expand Up @@ -245,20 +246,15 @@
numpy precision constant

Raises
------
RuntimeError
if string is invalid
"""
if precision == "default":
return GLOBAL_NP_FLOAT_PRECISION
elif precision == "float16":
return np.float16
elif precision == "float32":
return np.float32
elif precision == "float64":
return np.float64
else:
raise RuntimeError(f"{precision} is not a valid precision")
from deepmd.dpmodel.common import (
get_xp_precision,
)
Comment thread
njzjz marked this conversation as resolved.
Comment on lines +253 to +255

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
deepmd.dpmodel.common
begins an import cycle.

return get_xp_precision(np, precision)


def symlink_prefix_files(old_prefix: str, new_prefix: str) -> None:
Expand Down