Skip to content

Commit a5b9a6d

Browse files
committed
test(dpa4): address array api strict review comments
1 parent 668dd1f commit a5b9a6d

2 files changed

Lines changed: 12 additions & 15 deletions

File tree

source/tests/array_api_strict/descriptor/dpa4.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# SPDX-License-Identifier: LGPL-3.0-or-later
2+
from importlib import (
3+
import_module,
4+
)
5+
26
from deepmd.dpmodel.descriptor.dpa4 import DescrptDPA4 as DescrptDPA4DP
37
from deepmd.dpmodel.descriptor.dpa4_nn.activation import (
48
SwiGLU,
@@ -19,12 +23,13 @@
1923
array_api_strict_module,
2024
register_dpmodel_mapping,
2125
)
22-
from ..utils import exclude_mask as _strict_exclude_mask # noqa: F401
23-
from ..utils import network as _strict_network # noqa: F401
2426
from .base_descriptor import (
2527
BaseDescriptor,
2628
)
2729

30+
import_module("..utils.exclude_mask", __package__)
31+
import_module("..utils.network", __package__)
32+
2833

2934
@BaseDescriptor.register("SeZM")
3035
@BaseDescriptor.register("sezm")

source/tests/array_api_strict/fitting/dpa4_ener.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# SPDX-License-Identifier: LGPL-3.0-or-later
2+
from importlib import (
3+
import_module,
4+
)
25
from typing import (
36
ClassVar,
47
)
@@ -13,9 +16,9 @@
1316

1417
from ..common import (
1518
array_api_strict_module,
16-
register_dpmodel_mapping,
1719
)
18-
from ..utils import network as _strict_network # noqa: F401
20+
21+
import_module("..utils.network", __package__)
1922

2023

2124
@array_api_strict_module
@@ -33,14 +36,3 @@ class SeZMNetworkCollection(SeZMNetworkCollectionDP):
3336
@array_api_strict_module
3437
class SeZMEnergyFittingNet(SeZMEnergyFittingNetDP):
3538
pass
36-
37-
38-
register_dpmodel_mapping(
39-
GLUFittingNetDP,
40-
lambda v: GLUFittingNet.deserialize(v.serialize()),
41-
)
42-
43-
register_dpmodel_mapping(
44-
SeZMNetworkCollectionDP,
45-
lambda v: SeZMNetworkCollection.deserialize(v.serialize()),
46-
)

0 commit comments

Comments
 (0)