Commit 1550599
fix(tabulate): add c1 extrapolation outside tables (deepmodeling#5601)
Fixes deepmodeling#5593.
This implements the C1 linear extrapolation suggested in
deepmodeling#5593 (comment):
- keep the original out-of-range coordinate and evaluate the endpoint
value/slope at the proper boundary offset
- linearly extend table values outside the covered range while keeping
gradients at the constant boundary slope
- apply the same behavior to se_a, se_r, se_t, and se_t_tebd on CPU and
GPU paths
- add focused lib tests for lower/high tails, boundary continuity,
finite-difference force consistency, and zero tail curvature
Validation:
- ruff check .
- ruff format .
- cmake --build source/build --target runUnitTests_lib -j2
- source/build/lib/tests/runUnitTests_lib
--gtest_filter='TestTabulateSeA.tabulate_fusion_se_a_cpu:TestTabulateSeA.tabulate_fusion_se_a_grad_cpu:TestTabulateSeR.tabulate_fusion_se_r_cpu:TestTabulateSeR.tabulate_fusion_se_r_grad_cpu:TestTabulateSeT.tabulate_fusion_se_t_cpu:TestTabulateSeT.tabulate_fusion_se_t_grad_cpu:TestTabulateSeTTebd.tabulate_fusion_se_t_tebd_cpu:TestTabulateSeTTebd.tabulate_fusion_se_t_tebd_grad_cpu:TabulateExtrapolate.*'
Note: I used the existing source/build directory reconfigured as
TensorFlow-only locally because the previous cache had ENABLE_PYTORCH=ON
with a CUDA PyTorch install but no CUDA toolkit available.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Tabulated SE polynomial evaluations now use an extrapolation-aware
form for out-of-range inputs, improving smoothness and continuity at
both lower and upper table boundaries across SE-a, SE-t, SE-t-tebd, and
SE-r.
* **Bug Fixes**
* Corrected boundary/tail handling so value and gradient computations
remain consistent near min/max, including off-grid max behavior;
gradients now incorporate extrapolated results where needed.
* **Tests**
* Added CPU and GPU test coverage validating value/gradient/grad-grad
consistency via polynomial reference comparisons and finite-difference
checks for all supported SE variants.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent 58bef11 commit 1550599
3 files changed
Lines changed: 1256 additions & 184 deletions
0 commit comments