diff --git a/source/tests/pt/test_LKF.py b/source/tests/pt/test_LKF.py index 9b8fda529a..33aeac7f4f 100644 --- a/source/tests/pt/test_LKF.py +++ b/source/tests/pt/test_LKF.py @@ -1,4 +1,6 @@ # SPDX-License-Identifier: LGPL-3.0-or-later +import json +import os import unittest from pathlib import ( Path, @@ -8,9 +10,6 @@ main, ) -import json -import os - class TestLKF(unittest.TestCase): def test_lkf(self): diff --git a/source/tests/pt/test_descriptor.py b/source/tests/pt/test_descriptor.py index cfbdfb5185..172911ce56 100644 --- a/source/tests/pt/test_descriptor.py +++ b/source/tests/pt/test_descriptor.py @@ -9,6 +9,9 @@ tf.disable_eager_execution() import json +from pathlib import ( + Path, +) from deepmd.pt.model.descriptor import ( prod_env_mat_se_a, @@ -22,7 +25,7 @@ from deepmd.pt.utils.env import ( DEVICE, GLOBAL_NP_FLOAT_PRECISION, - GLOBAL_PT_FLOAT_PRECISION + GLOBAL_PT_FLOAT_PRECISION, ) from deepmd.tf.common import ( expand_sys_str, @@ -30,9 +33,6 @@ from deepmd.tf.env import ( op_module, ) -from pathlib import ( - Path, -) CUR_DIR = os.path.dirname(__file__) diff --git a/source/tests/pt/test_embedding_net.py b/source/tests/pt/test_embedding_net.py index 7b940f5487..0f36994184 100644 --- a/source/tests/pt/test_embedding_net.py +++ b/source/tests/pt/test_embedding_net.py @@ -10,6 +10,10 @@ tf.disable_eager_execution() +from pathlib import ( + Path, +) + from deepmd.pt.model.descriptor import ( DescrptSeA, ) @@ -21,17 +25,13 @@ ) from deepmd.pt.utils.env import ( DEVICE, - GLOBAL_NP_FLOAT_PRECISION + GLOBAL_NP_FLOAT_PRECISION, ) from deepmd.tf.common import ( expand_sys_str, ) from deepmd.tf.descriptor import DescrptSeA as DescrptSeA_tf -from pathlib import ( - Path, -) - CUR_DIR = os.path.dirname(__file__) diff --git a/source/tests/pt/test_force_grad.py b/source/tests/pt/test_force_grad.py index 9079b7fe65..1e6f08fd39 100644 --- a/source/tests/pt/test_force_grad.py +++ b/source/tests/pt/test_force_grad.py @@ -2,6 +2,9 @@ import copy import json import unittest +from pathlib import ( + Path, +) from typing import ( List, Optional, @@ -25,9 +28,7 @@ from deepmd.pt.utils.stat import ( make_stat_input, ) -from pathlib import ( - Path, -) + class CheckSymmetry(DeepmdDataSystem): def __init__( diff --git a/source/tests/pt/test_loss.py b/source/tests/pt/test_loss.py index de26070c96..0d6e1a84dc 100644 --- a/source/tests/pt/test_loss.py +++ b/source/tests/pt/test_loss.py @@ -8,6 +8,10 @@ import torch tf.disable_eager_execution() +from pathlib import ( + Path, +) + from deepmd.pt.loss import ( EnergyStdLoss, ) @@ -20,10 +24,6 @@ from deepmd.tf.loss.ener import ( EnerStdLoss, ) -from pathlib import ( - Path, -) - CUR_DIR = os.path.dirname(__file__) diff --git a/source/tests/pt/test_model.py b/source/tests/pt/test_model.py index 921195ca09..272114417d 100644 --- a/source/tests/pt/test_model.py +++ b/source/tests/pt/test_model.py @@ -9,6 +9,10 @@ tf.disable_eager_execution() +from pathlib import ( + Path, +) + from deepmd.pt.loss import ( EnergyStdLoss, ) @@ -19,7 +23,7 @@ DpLoaderSet, ) from deepmd.pt.utils.env import ( - DEVICE + DEVICE, ) from deepmd.pt.utils.learning_rate import LearningRateExp as MyLRExp from deepmd.pt.utils.stat import ( @@ -46,10 +50,6 @@ LearningRateExp, ) -from pathlib import ( - Path, -) - VariableState = collections.namedtuple("VariableState", ["value", "gradient"]) diff --git a/source/tests/pt/test_rotation.py b/source/tests/pt/test_rotation.py index 5000d07dfe..e30542434b 100644 --- a/source/tests/pt/test_rotation.py +++ b/source/tests/pt/test_rotation.py @@ -1,6 +1,9 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import json import unittest +from pathlib import ( + Path, +) from typing import ( List, Optional, @@ -28,10 +31,6 @@ make_stat_input, ) -from pathlib import ( - Path, -) - class CheckSymmetry(DeepmdDataSystem): def __init__( diff --git a/source/tests/pt/test_sampler.py b/source/tests/pt/test_sampler.py index 15985ea07f..ed4ad5956a 100644 --- a/source/tests/pt/test_sampler.py +++ b/source/tests/pt/test_sampler.py @@ -2,15 +2,15 @@ import json import os import unittest +from pathlib import ( + Path, +) import numpy as np from torch.utils.data import ( DataLoader, ) -from deepmd.pt.utils import ( - env, -) from deepmd.pt.utils.dataloader import ( DpLoaderSet, get_weighted_sampler, @@ -22,9 +22,6 @@ from deepmd.tf.utils.data_system import ( DeepmdDataSystem, ) -from pathlib import ( - Path, -) CUR_DIR = os.path.dirname(__file__) diff --git a/source/tests/pt/test_saveload_se_e2_a.py b/source/tests/pt/test_saveload_se_e2_a.py index e5f7a2130a..1069fdaddd 100644 --- a/source/tests/pt/test_saveload_se_e2_a.py +++ b/source/tests/pt/test_saveload_se_e2_a.py @@ -3,6 +3,9 @@ import json import os import unittest +from pathlib import ( + Path, +) import torch from torch.utils.data import ( @@ -31,9 +34,6 @@ from deepmd.tf.common import ( expand_sys_str, ) -from pathlib import ( - Path, -) def get_dataset(config): diff --git a/source/tests/pt/test_stat.py b/source/tests/pt/test_stat.py index 4d2a339ecc..dc16d39a80 100644 --- a/source/tests/pt/test_stat.py +++ b/source/tests/pt/test_stat.py @@ -2,6 +2,9 @@ import json import os import unittest +from pathlib import ( + Path, +) import numpy as np import torch @@ -33,10 +36,6 @@ DeepmdDataSystem, ) -from pathlib import ( - Path, -) - CUR_DIR = os.path.dirname(__file__)