File tree Expand file tree Collapse file tree
source/tests/common/dpmodel Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 TYPE_CHECKING ,
1313)
1414
15- from deepmd .dpmodel .atomic_model .dp_atomic_model import (
16- DPAtomicModel as DPAtomicModelDP ,
17- )
15+ from deepmd .dpmodel .atomic_model .dp_atomic_model import DPAtomicModel as DPAtomicModelDP
1816from deepmd .dpmodel .atomic_model .inner_potential import (
1917 InnerPotentialAtomicModel as InnerPotentialAtomicModelDP ,
2018)
2422from deepmd .dpmodel .model .model_factory import (
2523 BackendModelFactory ,
2624)
27- from deepmd .pt_expt .common import (
28- auto_wrapped_class ,
29- )
3025from deepmd .dpmodel .model .model_factory import (
3126 get_spin_model as get_spin_model_from_factory ,
3227)
28+ from deepmd .pt_expt .common import (
29+ auto_wrapped_class ,
30+ )
3331from deepmd .pt_expt .descriptor import (
3432 BaseDescriptor ,
3533)
Original file line number Diff line number Diff line change @@ -276,15 +276,11 @@ def test_focus_batched_lowering_matches_einsum_backward(kind) -> None:
276276 rng = np .random .default_rng (2026 )
277277
278278 if kind == "contract" :
279- from deepmd .pt .model .descriptor .sezm_nn .grid_net import (
280- FrameContract as PTMixer ,
281- )
279+ from deepmd .pt .model .descriptor .sezm_nn .grid_net import FrameContract as PTMixer
282280
283281 in_dim = n_frames * channels
284282 else :
285- from deepmd .pt .model .descriptor .sezm_nn .grid_net import (
286- FrameExpand as PTMixer ,
287- )
283+ from deepmd .pt .model .descriptor .sezm_nn .grid_net import FrameExpand as PTMixer
288284
289285 in_dim = channels
290286 pt_mod = PTMixer (
@@ -326,12 +322,12 @@ def test_focus_batched_lowering_matches_einsum_backward(kind) -> None:
326322 )
327323
328324 # the dpmodel lowering agrees on the torch namespace, gradients included
325+ import array_api_compat
326+
329327 from deepmd .dpmodel .descriptor .dpa4_nn .grid_net import (
330328 _degree_batched_matmul ,
331329 )
332330
333- import array_api_compat
334-
335331 coeff_dp = coeff .detach ().clone ().requires_grad_ (True )
336332 dp_out = _degree_batched_matmul (
337333 array_api_compat .array_namespace (coeff_dp ),
You can’t perform that action at this time.
0 commit comments