From c93dec088f0cc5e1ed883032e2866c7fa87e6681 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Thu, 21 Nov 2024 05:37:29 -0500 Subject: [PATCH] fix(pt): detach coord when building nlist in DPA-2 (#4387) ## Summary by CodeRabbit - **New Features** - Enhanced memory optimization during computations in the descriptor class. - Streamlined selection parameter updates for improved clarity and maintainability. - **Bug Fixes** - Retained error handling for input validation in parameter initialization. - **Documentation** - Updated comments and documentation strings for better clarity on methods and parameters. Signed-off-by: Jinzhe Zeng --- deepmd/pt/model/descriptor/dpa2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepmd/pt/model/descriptor/dpa2.py b/deepmd/pt/model/descriptor/dpa2.py index b6c3c5bb4b..ae59ec90f8 100644 --- a/deepmd/pt/model/descriptor/dpa2.py +++ b/deepmd/pt/model/descriptor/dpa2.py @@ -757,7 +757,7 @@ def forward( nall = extended_coord.view(nframes, -1).shape[1] // 3 # nlists nlist_dict = build_multiple_neighbor_list( - extended_coord, + extended_coord.detach(), nlist, self.rcut_list, self.nsel_list,