Skip to content

Commit

Permalink
fix for loop; fix codeql warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
njzjz authored Oct 31, 2024
1 parent cb15335 commit 15bf3e2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions deepmd/pt/utils/tabulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Check warning on line 302 in deepmd/pt/utils/tabulate.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/utils/tabulate.py#L302

Added line #L302 was not covered by tests

def _get_layer_size(self):
# get the number of layers in EmbeddingNet
Expand Down
1 change: 1 addition & 0 deletions deepmd/tf/utils/tabulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Check warning on line 183 in deepmd/tf/utils/tabulate.py

View check run for this annotation

Codecov / codecov/patch

deepmd/tf/utils/tabulate.py#L183

Added line #L183 was not covered by tests

def _get_bias(self):
bias = {}
Expand Down
6 changes: 6 additions & 0 deletions deepmd/utils/tabulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 15bf3e2

Please sign in to comment.