From 516ff0336e2dd13c1e0c3a46a37a13042ed82da0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 19:57:37 +0000 Subject: [PATCH 1/3] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.14 → v0.2.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.14...v0.2.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0fd2d1b40f..85486e3901 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: exclude: ^source/3rdparty - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.1.14 + rev: v0.2.0 hooks: - id: ruff args: ["--fix"] From 7d70c5457af59901af5a4e6642bdd232713721d8 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 5 Feb 2024 15:49:37 -0500 Subject: [PATCH 2/3] fix errors --- deepmd/tf/descriptor/loc_frame.py | 2 +- deepmd/tf/descriptor/se_a.py | 2 +- deepmd/tf/descriptor/se_r.py | 2 +- deepmd/tf/descriptor/se_t.py | 2 +- pyproject.toml | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deepmd/tf/descriptor/loc_frame.py b/deepmd/tf/descriptor/loc_frame.py index b43678c381..1e181ea764 100644 --- a/deepmd/tf/descriptor/loc_frame.py +++ b/deepmd/tf/descriptor/loc_frame.py @@ -343,7 +343,7 @@ def prod_force_virial( tf.summary.histogram("net_derivative", net_deriv) net_deriv_reshape = tf.reshape( net_deriv, - [np.cast["int64"](-1), natoms[0] * np.cast["int64"](self.ndescrpt)], + [np.asarray(-1, dtype=np.int64), natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64)], ) force = op_module.prod_force( net_deriv_reshape, diff --git a/deepmd/tf/descriptor/se_a.py b/deepmd/tf/descriptor/se_a.py index f1f90451fc..9e72a06d2a 100644 --- a/deepmd/tf/descriptor/se_a.py +++ b/deepmd/tf/descriptor/se_a.py @@ -708,7 +708,7 @@ def prod_force_virial( tf.summary.histogram("net_derivative", net_deriv) net_deriv_reshape = tf.reshape( net_deriv, - [np.cast["int64"](-1), natoms[0] * np.cast["int64"](self.ndescrpt)], + [np.asarray(-1, dtype=np.int64), natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64)], ) force = op_module.prod_force_se_a( net_deriv_reshape, diff --git a/deepmd/tf/descriptor/se_r.py b/deepmd/tf/descriptor/se_r.py index ac94ec0614..2228089743 100644 --- a/deepmd/tf/descriptor/se_r.py +++ b/deepmd/tf/descriptor/se_r.py @@ -500,7 +500,7 @@ def prod_force_virial( tf.summary.histogram("net_derivative", net_deriv) net_deriv_reshape = tf.reshape( net_deriv, - [np.cast["int64"](-1), natoms[0] * np.cast["int64"](self.ndescrpt)], + [np.asarray(-1, dtype=np.int64), natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64)], ) force = op_module.prod_force_se_r( net_deriv_reshape, self.descrpt_deriv, self.nlist, natoms diff --git a/deepmd/tf/descriptor/se_t.py b/deepmd/tf/descriptor/se_t.py index 98f4cf8212..76acff693c 100644 --- a/deepmd/tf/descriptor/se_t.py +++ b/deepmd/tf/descriptor/se_t.py @@ -513,7 +513,7 @@ def prod_force_virial( [net_deriv] = tf.gradients(atom_ener, self.descrpt_reshape) net_deriv_reshape = tf.reshape( net_deriv, - [np.cast["int64"](-1), natoms[0] * np.cast["int64"](self.ndescrpt)], + [np.asarray(-1, dtype=np.int64), natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64)], ) force = op_module.prod_force_se_a( net_deriv_reshape, diff --git a/pyproject.toml b/pyproject.toml index aa0da4725d..e4096b37b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -224,7 +224,7 @@ ignore = "D413, D416, D203, D107, D213" profile = "black" force_grid_wrap = 1 -[tool.ruff] +[tool.ruff.lint] select = [ "E", # errors "F", # pyflakes @@ -252,7 +252,7 @@ ignore = [ ] ignore-init-module-imports = true -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "numpy" [tool.pytest.ini_options] From f759abd3ef1888c0a6ec24ab282c0bdf4ebc25cd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 20:49:58 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- deepmd/tf/descriptor/loc_frame.py | 5 ++++- deepmd/tf/descriptor/se_a.py | 5 ++++- deepmd/tf/descriptor/se_r.py | 5 ++++- deepmd/tf/descriptor/se_t.py | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/deepmd/tf/descriptor/loc_frame.py b/deepmd/tf/descriptor/loc_frame.py index 1e181ea764..185c5062aa 100644 --- a/deepmd/tf/descriptor/loc_frame.py +++ b/deepmd/tf/descriptor/loc_frame.py @@ -343,7 +343,10 @@ def prod_force_virial( tf.summary.histogram("net_derivative", net_deriv) net_deriv_reshape = tf.reshape( net_deriv, - [np.asarray(-1, dtype=np.int64), natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64)], + [ + np.asarray(-1, dtype=np.int64), + natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64), + ], ) force = op_module.prod_force( net_deriv_reshape, diff --git a/deepmd/tf/descriptor/se_a.py b/deepmd/tf/descriptor/se_a.py index 9e72a06d2a..01c4ee8844 100644 --- a/deepmd/tf/descriptor/se_a.py +++ b/deepmd/tf/descriptor/se_a.py @@ -708,7 +708,10 @@ def prod_force_virial( tf.summary.histogram("net_derivative", net_deriv) net_deriv_reshape = tf.reshape( net_deriv, - [np.asarray(-1, dtype=np.int64), natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64)], + [ + np.asarray(-1, dtype=np.int64), + natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64), + ], ) force = op_module.prod_force_se_a( net_deriv_reshape, diff --git a/deepmd/tf/descriptor/se_r.py b/deepmd/tf/descriptor/se_r.py index 2228089743..f790d0a8fb 100644 --- a/deepmd/tf/descriptor/se_r.py +++ b/deepmd/tf/descriptor/se_r.py @@ -500,7 +500,10 @@ def prod_force_virial( tf.summary.histogram("net_derivative", net_deriv) net_deriv_reshape = tf.reshape( net_deriv, - [np.asarray(-1, dtype=np.int64), natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64)], + [ + np.asarray(-1, dtype=np.int64), + natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64), + ], ) force = op_module.prod_force_se_r( net_deriv_reshape, self.descrpt_deriv, self.nlist, natoms diff --git a/deepmd/tf/descriptor/se_t.py b/deepmd/tf/descriptor/se_t.py index 76acff693c..c72296daa7 100644 --- a/deepmd/tf/descriptor/se_t.py +++ b/deepmd/tf/descriptor/se_t.py @@ -513,7 +513,10 @@ def prod_force_virial( [net_deriv] = tf.gradients(atom_ener, self.descrpt_reshape) net_deriv_reshape = tf.reshape( net_deriv, - [np.asarray(-1, dtype=np.int64), natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64)], + [ + np.asarray(-1, dtype=np.int64), + natoms[0] * np.asarray(self.ndescrpt, dtype=np.int64), + ], ) force = op_module.prod_force_se_a( net_deriv_reshape,