Commit 73de44b
feat(tf2): add eager TensorFlow array backend (deepmodeling#5598)
## Summary
- vendor ndtensorflow under deepmd/_vendors and add a TensorFlow eager
Array API backend under deepmd/tf2
- implement tf2 model wrappers, tf.function SavedModel export/deep-eval
glue, and backend registration for .savedmodel
- replace jax/jax2tf TensorFlow helper implementations with tf2
compatibility exports
- add focused tf2 consistency tests for eager and tf.function model
paths
## Tests
- ruff check .
- ruff format .
- pytest source/tests/consistent/test_tf2_backend.py -q
- manual SavedModel export/load smoke test
Note: local pre-commit hook attempted to fetch astral-sh/ruff-pre-commit
and timed out on GitHub port 443; the commit was created with
--no-verify after running the checks above manually.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added a TensorFlow 2 eager backend with SavedModel inference plus TF2
model/descriptor/fitting wrappers (energy/dipole/polar/DOS/property).
* Introduced TF2 neighbor-list construction, region/PBC geometry
utilities, and output/ghost-atom aggregation.
* Expanded the TensorFlow-backed Array API with namespace, FFT, and
linear algebra utilities.
* **Bug Fixes**
* Improved the non-eager TensorFlow compatibility error message.
* **Refactor**
* Converted multiple JAX2TF modules into TF2 compatibility shims that
re-export TF2 implementations.
* **Tests**
* Added TF2 consistency coverage, including subprocess-based checks.
* **Chores**
* Added license headers/docs and updated lint configuration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: Jinzhe Zeng <njzjz@qq.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: njzjz-bot (driven by OpenClaw (model: custom-chat-jinzhezeng-group/gpt-5.5))[bot] <48687836+njzjz-bot@users.noreply.github.com>1 parent f143171 commit 73de44b
118 files changed
Lines changed: 8283 additions & 1021 deletions
File tree
- .github/workflows
- deepmd
- _vendors
- ndtensorflow
- backend
- dpmodel
- atomic_model
- descriptor
- model
- utils
- jax
- jax2tf
- utils
- tf2
- atomic_model
- descriptor
- fitting
- infer
- model
- utils
- source
- api_cc
- src
- tests
- jax2tf_tests
- tests
- common
- consistent
- descriptor
- fitting
- io
- loss
- model
- infer
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
67 | 91 | | |
68 | 92 | | |
69 | 93 | | |
70 | 94 | | |
71 | | - | |
| 95 | + | |
72 | 96 | | |
73 | 97 | | |
74 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
0 commit comments