Skip to content

Commit ecc411e

Browse files
author
Han Wang
committed
fixes
1 parent f6a695f commit ecc411e

6 files changed

Lines changed: 12 additions & 12 deletions

File tree

deepmd/jax/infer/deep_eval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def _eval_model(
388388

389389
results = []
390390
for odef in request_defs:
391-
dp_name = self._OUTDEF_DP2BACKEND[odef.name]
391+
dp_name = odef.name
392392
if dp_name in batch_output:
393393
shape = self._get_output_shape(odef, nframes, natoms)
394394
if batch_output[dp_name] is not None:

deepmd/jax/jax2tf/serialization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def deserialize_to_file(model_file: str, data: dict) -> None:
3434
if model_file.endswith(".savedmodel"):
3535
model = BaseModel.deserialize(data["model"])
3636
model_def_script = data["model_def_script"]
37-
call_lower = model.call_lower
37+
call_lower = model.call_common_lower
3838

3939
tf_model = tf.Module()
4040

deepmd/jax/utils/serialization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def deserialize_to_file(model_file: str, data: dict) -> None:
4949
elif model_file.endswith(".hlo"):
5050
model = BaseModel.deserialize(data["model"])
5151
model_def_script = data["model_def_script"]
52-
call_lower = model.call_lower
52+
call_lower = model.call_common_lower
5353

5454
nf, nloc, nghost = jax_export.symbolic_shape("nf, nloc, nghost")
5555

source/tests/common/dpmodel/test_padding_atoms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def test_padding_atoms_consistency(self):
6969
result = model.call(*args)
7070
# test intensive
7171
np.testing.assert_allclose(
72-
result[f"{var_name}_redu"],
73-
np.mean(result[f"{var_name}"], axis=1),
72+
result[var_name],
73+
np.mean(result[f"atom_{var_name}"], axis=1),
7474
atol=self.atol,
7575
)
7676
# test padding atoms
@@ -93,8 +93,8 @@ def test_padding_atoms_consistency(self):
9393
args = [coord_padding, atype_padding, self.cell]
9494
result_padding = model.call(*args)
9595
np.testing.assert_allclose(
96-
result[f"{var_name}_redu"],
97-
result_padding[f"{var_name}_redu"],
96+
result[var_name],
97+
result_padding[var_name],
9898
atol=self.atol,
9999
)
100100

source/tests/consistent/model/test_property.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ def extract_ret(self, ret: Any, backend) -> tuple[np.ndarray, ...]:
186186
property_name = self.data["fitting_net"]["property_name"]
187187
if backend in {self.RefBackend.DP, self.RefBackend.JAX}:
188188
return (
189-
ret[f"{property_name}_redu"].ravel(),
190189
ret[property_name].ravel(),
190+
ret[f"atom_{property_name}"].ravel(),
191191
)
192192
elif backend is self.RefBackend.PT:
193193
return (

source/tests/jax/test_padding_atoms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ def test_padding_atoms_consistency(self):
8989
result = model.call(*args)
9090
# test intensive
9191
np.testing.assert_allclose(
92-
to_numpy_array(result[f"{var_name}_redu"]),
93-
np.mean(to_numpy_array(result[f"{var_name}"]), axis=1),
92+
to_numpy_array(result[var_name]),
93+
np.mean(to_numpy_array(result[f"atom_{var_name}"]), axis=1),
9494
atol=self.atol,
9595
)
9696
# test padding atoms
@@ -115,8 +115,8 @@ def test_padding_atoms_consistency(self):
115115
]
116116
result_padding = model.call(*args)
117117
np.testing.assert_allclose(
118-
to_numpy_array(result[f"{var_name}_redu"]),
119-
to_numpy_array(result_padding[f"{var_name}_redu"]),
118+
to_numpy_array(result[var_name]),
119+
to_numpy_array(result_padding[var_name]),
120120
atol=self.atol,
121121
)
122122

0 commit comments

Comments
 (0)