CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
A template demonstrating how to test higher-order autodiff. #62917
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
def check_vjp(func, args, order=2, atol=None, rtol=None, eps=EPS): | ||
paddle.framework.core.set_prim_eager_enabled(True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用Python上下文管理器或Try-catch确保函数执行完后prim开关关闭
if core.is_compiled_with_cuda(): | ||
places.append(base.CUDAPlace(0)) | ||
for p in places: | ||
self.check_vjp(p) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
命名建议统一,避免 vjp/grad 混用
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里考虑的是后续可以添加一个self.check_jvp()
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该不需要那么复杂的包装,也不需要区分一元/多元运算,比如
class TestXXHigherOrderAD(unittest.TestCase):
...
@param.parameterized(...)
def test_xx(func, args, kwargs, argnums: Tuple[int], order, options):
"""
...
args, kwargs表示func的参数
argnums表示对第几个args求导
order表示阶数
"""
不需要VJP子目录 |
注释写的详细一些,也可以在ReadMe细化,让开发者能够按步骤新增用例 |
PR标题: A template demonstrating how to test higher-order autodiff. |
Sorry to inform you that 90c956f's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
… add_high_order_test
Sorry to inform you that 7e0a7ba's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ddle#62917) * add composite high order test * remove static * add test subdirectory * fix cmake error * fix high grad test bug * rm tanh * add timeout limit * add prim scope * opt * opt * fix places * opt
…ddle#62917) * add composite high order test * remove static * add test subdirectory * fix cmake error * fix high grad test bug * rm tanh * add timeout limit * add prim scope * opt * opt * fix places * opt
PR Category
Others
PR Types
Others
Description
pcard-81841
A template demonstrating how to test higher-order autodiff.