diff --git a/deepmd/jax/descriptor/dpa2.py b/deepmd/jax/descriptor/dpa2.py index 6f4fe691e1..8eea324b41 100644 --- a/deepmd/jax/descriptor/dpa2.py +++ b/deepmd/jax/descriptor/dpa2.py @@ -54,7 +54,8 @@ def __setattr__(self, name: str, value: Any) -> None: elif isinstance(value, NativeLayerDP): value = NativeLayer.deserialize(value.serialize()) elif isinstance(value, IdentityDP): - value = IdentityDP.deserialize(value.serialize()) + # IdentityDP doesn't contain any value - it's good to go + pass else: raise ValueError(f"Unknown layer type: {type(value)}") return super().__setattr__(name, value) diff --git a/source/tests/array_api_strict/descriptor/dpa2.py b/source/tests/array_api_strict/descriptor/dpa2.py index ef2c83ef3d..a510c6b461 100644 --- a/source/tests/array_api_strict/descriptor/dpa2.py +++ b/source/tests/array_api_strict/descriptor/dpa2.py @@ -50,7 +50,8 @@ def __setattr__(self, name: str, value: Any) -> None: elif isinstance(value, NativeLayerDP): value = NativeLayer.deserialize(value.serialize()) elif isinstance(value, IdentityDP): - value = IdentityDP.deserialize(value.serialize()) + # IdentityDP doesn't contain any value - it's good to go + pass else: raise ValueError(f"Unknown layer type: {type(value)}") return super().__setattr__(name, value)