Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New features] Support batch_jacobian and batch_hessian #37547

Merged
merged 66 commits into from
Nov 29, 2021

Conversation

veyron95
Copy link
Contributor

@veyron95 veyron95 commented Nov 25, 2021

PR types

New features

PR changes

APIs

Describe

  1. Add batch_jacobian and batch_hessian and supplement the corresponding description.
  2. Add numerical_batch_jacobian and numerical_batch_hessian for verifying the correctness of new features.
  3. Add the corresponding unit tests to ensure the robustness of new features.

The batch version jacobian and hessian, obtains 200 times faster than the previous version.

veyron95 and others added 30 commits September 22, 2021 04:09
native commit for triple grad of sigmod
@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@veyron95 veyron95 changed the title Support batch_jacobian and batch_hessian [New features] Support batch_jacobian and batch_hessian Nov 25, 2021
python/paddle/autograd/functional.py Outdated Show resolved Hide resolved
python/paddle/autograd/functional.py Outdated Show resolved Hide resolved
python/paddle/autograd/functional.py Outdated Show resolved Hide resolved
python/paddle/fluid/tests/unittests/autograd/utils.py Outdated Show resolved Hide resolved
python/paddle/autograd/functional.py Show resolved Hide resolved
Copy link
Contributor

@XieYunshen XieYunshen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for set_tests_properties(test_jacobian PROPERTIES TIMEOUT 50)

@levi131 levi131 merged commit 4d24d35 into PaddlePaddle:develop Nov 29, 2021
Zjq9409 pushed a commit to Zjq9409/Paddle that referenced this pull request Dec 10, 2021
…#37547)

* native commit for triple grad of sigmod

* Updated unittests files

* init functional jacobian api

* Updated trible_test func

* Updated gradient_checker & test_script

* finish test with dtype float32

* add float64 test case

* polish code

* use atol=1e-5 with dtype float64

* fix for ci

* set timeout for test_jacobian

* fix dygraph grad to support high differential

* polish API docstring

* Updated gradient checker and some related files

* fix double grad strip error for high differential

* fix double grad strip error for high differential

* Add Sigmoid triple grad tests

* fix dygraph double grad dtype error when calling for high differential senario

* Updated triple grad teses func

* Use np.random to initialize ddx

* Updated triple_grad_check func

* add todo for gradient checker and refine some comments

* remove additional code

* add test for warnging in backward.py

* format python code

* support multi input in triple gradient checker

* Add matmul triple grad kernel

* Updated comments of TODO

* Supported some special tests

* Change code-format to follow CI std

* Updated gradient_checker.py

* Fix conflicts

* Removed unnecessary printing log

* Change code style to follow CI std

* support batch in jacobian and hessian

* add batch jacobian and batch hessian

* Add batch_jacobian test, draft version

* [New features] Add elementwise_mul triple grad kernel (PaddlePaddle#37152)

* Add elementwise_mul triple grad kernel

* Removed InplaceInferer and polished code

* Add numerical_batch_jacobian,numerical_batch_hessian and tests

* Support batch_jacobian and batch_numerical

* Use pre-commit to check code format

* Update doc, polish code, add unit test

* Reset the TIMEOUT properties of test_jacobian to pass CI

Co-authored-by: levi131 <limaolin01@baidu.com>
Co-authored-by: Jiabin Yang <360788950@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants