Skip to content

Commit

Permalink
fix: UTs
Browse files Browse the repository at this point in the history
  • Loading branch information
anyangml committed Apr 13, 2024
1 parent bd079b9 commit 53dbe13
Showing 1 changed file with 14 additions and 38 deletions.
52 changes: 14 additions & 38 deletions source/tests/pt/model/test_dp_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import torch

from deepmd.dpmodel.descriptor import DescrptSeA as DPDescrptSeA
from deepmd.dpmodel.fitting import InvarFitting as DPInvarFitting
from deepmd.dpmodel.fitting import EnergyFittingNet as DPEnergyFittingNet
from deepmd.dpmodel.model.ener_model import EnergyModel as DPEnergyModel
from deepmd.pt.model.descriptor.se_a import (
DescrptSeA,
Expand All @@ -14,7 +14,7 @@
EnergyModel,
)
from deepmd.pt.model.task.ener import (
InvarFitting,
EnergyFittingNet,
)
from deepmd.pt.utils import (
env,
Expand Down Expand Up @@ -48,11 +48,9 @@ def test_self_consistency(self):
self.rcut_smth,
self.sel,
).to(env.DEVICE)
ft = InvarFitting(
"energy",
ft = EnergyFittingNet(
self.nt,
ds.get_dim_out(),
1,
mixed_types=ds.mixed_types(),
).to(env.DEVICE)
type_map = ["foo", "bar"]
Expand Down Expand Up @@ -121,11 +119,9 @@ def test_dp_consistency(self):
self.rcut_smth,
self.sel,
)
ft = DPInvarFitting(
"energy",
ft = DPEnergyFittingNet(
self.nt,
ds.get_dim_out(),
1,
mixed_types=ds.mixed_types(),
numb_fparam=nfp,
numb_aparam=nap,
Expand Down Expand Up @@ -162,11 +158,9 @@ def test_dp_consistency_nopbc(self):
self.rcut_smth,
self.sel,
)
ft = DPInvarFitting(
"energy",
ft = DPEnergyFittingNet(
self.nt,
ds.get_dim_out(),
1,
mixed_types=ds.mixed_types(),
numb_fparam=nfp,
numb_aparam=nap,
Expand Down Expand Up @@ -203,11 +197,9 @@ def test_prec_consistency(self):
self.rcut_smth,
self.sel,
)
ft = DPInvarFitting(
"energy",
ft = DPEnergyFittingNet(
self.nt,
ds.get_dim_out(),
1,
mixed_types=ds.mixed_types(),
)
nfp, nap = 2, 3
Expand Down Expand Up @@ -258,11 +250,9 @@ def test_self_consistency(self):
self.rcut_smth,
self.sel,
).to(env.DEVICE)
ft = InvarFitting(
"energy",
ft = EnergyFittingNet(
self.nt,
ds.get_dim_out(),
1,
mixed_types=ds.mixed_types(),
).to(env.DEVICE)
type_map = ["foo", "bar"]
Expand Down Expand Up @@ -309,11 +299,9 @@ def test_dp_consistency(self):
self.rcut_smth,
self.sel,
)
ft = DPInvarFitting(
"energy",
ft = DPEnergyFittingNet(
self.nt,
ds.get_dim_out(),
1,
mixed_types=ds.mixed_types(),
)
type_map = ["foo", "bar"]
Expand Down Expand Up @@ -344,11 +332,9 @@ def test_prec_consistency(self):
self.rcut_smth,
self.sel,
)
ft = DPInvarFitting(
"energy",
ft = DPEnergyFittingNet(
self.nt,
ds.get_dim_out(),
1,
mixed_types=ds.mixed_types(),
)
nfp, nap = 2, 3
Expand Down Expand Up @@ -396,11 +382,9 @@ def test_jit(self):
self.rcut_smth,
self.sel,
).to(env.DEVICE)
ft = InvarFitting(
"energy",
ft = EnergyFittingNet(
self.nt,
ds.get_dim_out(),
1,
mixed_types=ds.mixed_types(),
).to(env.DEVICE)
type_map = ["foo", "bar"]
Expand Down Expand Up @@ -446,11 +430,9 @@ def setUp(self):
self.rcut_smth,
self.sel,
).to(env.DEVICE)
ft = InvarFitting(
"energy",
ft = EnergyFittingNet(
self.nt,
ds.get_dim_out(),
1,
mixed_types=ds.mixed_types(),
).to(env.DEVICE)
type_map = ["foo", "bar"]
Expand Down Expand Up @@ -519,11 +501,9 @@ def test_self_consistency(self):
self.rcut_smth,
self.sel,
).to(env.DEVICE)
ft = InvarFitting(
"energy",
ft = EnergyFittingNet(
self.nt,
ds.get_dim_out(),
1,
mixed_types=ds.mixed_types(),
).to(env.DEVICE)
type_map = ["foo", "bar"]
Expand Down Expand Up @@ -589,11 +569,9 @@ def test_self_consistency(self):
self.rcut_smth,
self.sel,
).to(env.DEVICE)
ft = InvarFitting(
"energy",
ft = EnergyFittingNet(
self.nt,
ds.get_dim_out(),
1,
mixed_types=ds.mixed_types(),
).to(env.DEVICE)
type_map = ["foo", "bar"]
Expand Down Expand Up @@ -639,11 +617,9 @@ def test_jit(self):
self.rcut_smth,
self.sel,
).to(env.DEVICE)
ft = InvarFitting(
"energy",
ft = EnergyFittingNet(
self.nt,
ds.get_dim_out(),
1,
mixed_types=ds.mixed_types(),
).to(env.DEVICE)
type_map = ["foo", "bar"]
Expand Down

0 comments on commit 53dbe13

Please sign in to comment.