From 15bf3e2361146496c9201a336096d476aaed776b Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Thu, 31 Oct 2024 15:38:15 -0400 Subject: [PATCH] fix for loop; fix codeql warnings --- deepmd/pt/utils/tabulate.py | 1 + deepmd/tf/utils/tabulate.py | 1 + deepmd/utils/tabulate.py | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/deepmd/pt/utils/tabulate.py b/deepmd/pt/utils/tabulate.py index a22389c516..fe20f35f0c 100644 --- a/deepmd/pt/utils/tabulate.py +++ b/deepmd/pt/utils/tabulate.py @@ -299,6 +299,7 @@ def _get_descrpt_type(self): return "R" elif isinstance(self.descrpt, deepmd.pt.model.descriptor.DescrptSeT): return "T" + raise RuntimeError(f"Unsupported descriptor {self.descrpt}") def _get_layer_size(self): # get the number of layers in EmbeddingNet diff --git a/deepmd/tf/utils/tabulate.py b/deepmd/tf/utils/tabulate.py index d06ba75d1a..30171b12db 100644 --- a/deepmd/tf/utils/tabulate.py +++ b/deepmd/tf/utils/tabulate.py @@ -180,6 +180,7 @@ def _get_descrpt_type(self): return "T" elif isinstance(self.descrpt, deepmd.tf.descriptor.DescrptSeR): return "R" + raise RuntimeError(f"Unsupported descriptor {self.descrpt}") def _get_bias(self): bias = {} diff --git a/deepmd/utils/tabulate.py b/deepmd/utils/tabulate.py index d8ed872ae3..7b40df6d86 100644 --- a/deepmd/utils/tabulate.py +++ b/deepmd/utils/tabulate.py @@ -172,6 +172,12 @@ def build( ).astype(int) idx = 0 for ii in range(self.ntypes): + if self.is_pt: + uu = np.max(upper[ii]) + ll = np.min(lower[ii]) + else: + ll = lower[ii] + uu = upper[ii] for jj in range(ii, self.ntypes): net = "filter_" + str(ii) + "_net_" + str(jj) self._build_lower(