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 reduce_max_grad composite rule #51653

Merged
merged 14 commits into from
Mar 22, 2023

Conversation

wangxn12138
Copy link
Contributor

@wangxn12138 wangxn12138 commented Mar 14, 2023

PR types

New features

PR changes

Others

Describe

add reduce_max_grad composite rule.
becuse original op test pass fp16, composite op test pass fp16 too.

@paddle-bot
Copy link

paddle-bot bot commented Mar 14, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@cyber-pioneer
Copy link
Contributor

pr name typo

@wangxn12138 wangxn12138 changed the title add rudece_max_comp_grad composite rule Add reduce_max_grad composite rule Mar 15, 2023
@wangxn12138
Copy link
Contributor Author

pr name typo

done

def test_check_grad(self):
# only composite op support gradient check of reduce_max
self.check_grad(['X'], 'Out', check_eager=True, only_check_prim=True)

def test_raise_error(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

if original test pass fp16, please describe it in pr describes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if original test pass fp16, please describe it in pr describes

done

@@ -271,6 +277,10 @@ def setUp(self):
def test_check_output(self):
self.check_output(check_eager=True)

def test_check_grad(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

why original op test don't support grad check

Copy link
Contributor

Choose a reason for hiding this comment

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

@Charles-hit if original op has no grad test how to compare with composite_grad

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why original op test don't support grad check

装饰器注明"reduce_max is discontinuous non-derivable function, its gradient check is not supported by unittest framework."

@@ -261,6 +266,7 @@ class TestMaxOp_ZeroDim(OpTest):

def setUp(self):
self.op_type = "reduce_max"
self.prim_op_type = "prim"
self.python_api = paddle.max
self.inputs = {'X': np.random.random([]).astype("float64")}
self.attrs = {'dim': []}
Copy link
Contributor

Choose a reason for hiding this comment

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

it's better add new op test to check keep_dim = True and FP32

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's better add new op test to check keep_dim = True and FP32

done

@@ -233,6 +233,7 @@ class TestMaxOp(OpTest):

def setUp(self):
self.op_type = "reduce_max"
self.prim_op_type = "prim"
self.python_api = paddle.max
self.inputs = {'X': np.random.random((5, 6, 10)).astype("float64")}
self.attrs = {'dim': [-1]}
Copy link
Contributor

Choose a reason for hiding this comment

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

it's better to check keep_dim = True

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's better to check keep_dim = True

done

@@ -37,6 +37,8 @@
- pad
- cumsum
- put_along_axis
- equal
- where
Copy link
Contributor

Choose a reason for hiding this comment

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

two where, delete one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

two where, delete one

done

@xiaoguoguo626807 xiaoguoguo626807 merged commit d04c9cd into PaddlePaddle:develop Mar 22, 2023
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.

4 participants