Skip to content

Commit

Permalink
set ascend_mix
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Sep 23, 2022
1 parent 3eb6609 commit 563f312
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion source/tests/test_ascend_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from deepmd.utils.graph import get_tensor_by_name

from deepmd.env import GLOBAL_NP_FLOAT_PRECISION
os.environ["DP_INTERFACE_PREC"] = "ascend_mix"

def _file_delete(file) :
if os.path.exists(file):
Expand All @@ -30,6 +29,8 @@ def _subprocess_run(command):
class TestTransform(unittest.TestCase) :
@classmethod
def setUpClass(self):
self.env = os.environ.get("DP_INTERFACE_PREC")
os.environ["DP_INTERFACE_PREC"] = "ascend_mix"
self.old_model = str(tests_path / "dp-old.pb")
self.new_model = str(tests_path / "dp-ascend.pb")
convert_pbtxt_to_pb(str(tests_path / os.path.join("infer","deeppot-2.pbtxt")), self.old_model)
Expand All @@ -55,6 +56,11 @@ def tearDownClass(self):
_file_delete("input_v2_compat.json")
_file_delete("lcurve.out")
shutil.rmtree("model-transfer")
if self.env:
os.environ["DP_INTERFACE_PREC"] = self.env
else:
del os.environ['DP_INTERFACE_PREC']


def test_attrs(self):
self.assertEqual(self.dp.get_ntypes(), 2)
Expand Down

0 comments on commit 563f312

Please sign in to comment.