Skip to content

Commit

Permalink
use math.prod
Browse files Browse the repository at this point in the history
  • Loading branch information
Han Wang committed Feb 13, 2024
1 parent f401eb6 commit 6573e19
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions deepmd/pt/model/model/make_hessian_model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
import copy
import math
from typing import (

Check warning on line 4 in deepmd/pt/model/model/make_hessian_model.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/model/model/make_hessian_model.py#L2-L4

Added lines #L2 - L4 were not covered by tests
Dict,
List,
Expand Down Expand Up @@ -139,9 +140,7 @@ def _cal_hessian_all(
for kk in hess_keys:
vdef = fdef[kk]
vshape = vdef.shape
vsize = 1
for ii in vshape:
vsize *= ii
vsize = math.prod(vdef.shape)

Check warning on line 143 in deepmd/pt/model/model/make_hessian_model.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/model/model/make_hessian_model.py#L140-L143

Added lines #L140 - L143 were not covered by tests
# loop over frames
for ii in range(nf):
icoord = coord[ii]
Expand Down

0 comments on commit 6573e19

Please sign in to comment.