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

Add support for forward and reverse high-order automatic differentiation mechanism #41919

Merged
merged 277 commits into from
May 18, 2022

Conversation

0x45f
Copy link
Contributor

@0x45f 0x45f commented Apr 18, 2022

PR types

New features

PR changes

Others

Describe

本pr配合pr #41201 一起构成一套新的自动微分机制
该自动微分机制目前只在静态图中生效,在一部分算子上,支持前向和反向的高阶自动微分。

本pr中包含的内容包括如下几个部分:
(1)在C++中注册的自动微分基础算子的python wrapper

(2)在自动微分基础算子之上定义的orig2prim,prim2orig,jvp,transpose规则

(3)在4种规则之上形成的orig2prim,prim2orig,linearize,transpose四种变换

       a、orig2prim paddle原生算子转化为自动微分基础算子
       b、prim2orig 自动微分基础算子转化为paddle原生算子
       c、linearize 根据前向计算计算图生成前向微分计算图
       d、transpose 根据前向微分计算图生成反向微分计算图

(4)提供出的用户接口

       a、沿用静态图中已经存在的gradients和minimize接口
       b、提供基于自动微分基础算子的自动微分机制切换的全局控制接口,enable_prim, disable_prim, prim_enabled
       c、将基础算子体系转化到原生算子体系以支撑执行的接口prim2orig

veyron95 and others added 30 commits September 28, 2021 08:54
python/paddle/incubate/autograd/utils.py Show resolved Hide resolved
python/paddle/incubate/autograd/primx.py Show resolved Hide resolved
python/paddle/incubate/autograd/primx.py Outdated Show resolved Hide resolved
python/paddle/incubate/autograd/utils.py Outdated Show resolved Hide resolved
python/paddle/incubate/autograd/utils.py Outdated Show resolved Hide resolved
python/paddle/incubate/autograd/utils.py Outdated Show resolved Hide resolved
python/paddle/incubate/autograd/utils.py Outdated Show resolved Hide resolved
python/paddle/incubate/autograd/utils.py Show resolved Hide resolved
python/paddle/incubate/autograd/utils.py Outdated Show resolved Hide resolved
python/paddle/incubate/autograd/primx.py Outdated Show resolved Hide resolved
python/paddle/incubate/autograd/utils.py Outdated Show resolved Hide resolved
@levi131
Copy link
Contributor

levi131 commented May 17, 2022

LGTM

Copy link
Contributor

@TCChenlong TCChenlong left a comment

Choose a reason for hiding this comment

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

LGTM

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_gradients_and_minimize PROPERTIES TIMEOUT 60)

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

@levi131 levi131 merged commit f6ee202 into PaddlePaddle:develop May 18, 2022
@0x45f 0x45f deleted the science-add-rules-ut branch May 18, 2022 08:05
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.

9 participants