Skip to content

Commit a6042c6

Browse files
authored
fix(jax): fix DPA3 force NaN with edge_init_use_dist (#4794)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved the stability and reliability of distance calculations during edge initialization, enhancing overall robustness. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Jinzhe Zeng <[email protected]>
1 parent 6ddc2c9 commit a6042c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

deepmd/dpmodel/descriptor/repflows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ def call(
526526
# edge_input, h2 = xp.split(dmatrix, [1], axis=-1)
527527
# nb x nloc x nnei x 1
528528
if self.edge_init_use_dist:
529-
edge_input = xp.linalg.vector_norm(diff, axis=-1, keepdims=True)
529+
edge_input = safe_for_vector_norm(diff, axis=-1, keepdims=True)
530530
else:
531531
edge_input = dmatrix[:, :, :, :1]
532532
h2 = dmatrix[:, :, :, 1:]

0 commit comments

Comments
 (0)