From f5cfeab050b818a87a1ff51363d439c3909a7bea Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 22 Sep 2024 21:23:22 -0400 Subject: [PATCH] fix(pt): fix `compute_output_stats_global` when `atomic_output` is `None` (#4155) ## Summary by CodeRabbit - **Bug Fixes** - Improved error handling by ensuring that the output data is not `None` before processing, preventing potential runtime errors. --- deepmd/pt/utils/stat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepmd/pt/utils/stat.py b/deepmd/pt/utils/stat.py index 6de70eb175..58e02f436d 100644 --- a/deepmd/pt/utils/stat.py +++ b/deepmd/pt/utils/stat.py @@ -478,7 +478,7 @@ def compute_output_stats_global( std_atom_e = {} for kk in keys: if kk in stats_input: - if atomic_output.get_data()[kk].intensive: + if atomic_output is not None and atomic_output.get_data()[kk].intensive: task_dim = stats_input[kk].shape[1] assert merged_natoms[kk].shape == (nf[kk], ntypes) stats_input[kk] = (