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

[AMP] Add bfloat16 Support for elementwise_pow Op #51888

Merged
merged 2 commits into from
Mar 23, 2023

Conversation

Bobholamovic
Copy link
Member

@Bobholamovic Bobholamovic commented Mar 20, 2023

PR types

Performance optimization

PR changes

OPs

Describe

Add bfloat16 support (on CPU, GPU, and XPU devices) for the elementwise_pow operator. The unittest cases get updated, too.

@@ -310,9 +311,9 @@ def setUp(self):

def test_check_output(self):
if hasattr(self, 'attrs'):
self.check_output(check_eager=False)
self.check_output(check_eager=False, atol=1e-3)
Copy link
Contributor

Choose a reason for hiding this comment

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

这里默认值可以不显式设置

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@@ -323,6 +324,34 @@ def test_check_grad(self):
),
check_eager=True,
check_prim=True,
max_relative_error=1e-2,
Copy link
Contributor

Choose a reason for hiding this comment

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

这个不设置会报错吗?之前应该是能过的?

Copy link
Member Author

Choose a reason for hiding this comment

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

不会报错,已移除


def test_check_grad(self):
self.check_grad(
['X', 'Y'], 'Out', check_eager=True, max_relative_error=1e-2
Copy link
Contributor

Choose a reason for hiding this comment

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

max_relative_error默认值可以不设置

Copy link
Member Author

@Bobholamovic Bobholamovic Mar 21, 2023

Choose a reason for hiding this comment

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

done


def test_check_output(self):
if hasattr(self, 'attrs'):
self.check_output(check_eager=False, atol=0.01)
Copy link
Contributor

Choose a reason for hiding this comment

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

atol默认值可以不设置

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@ZzSean ZzSean left a comment

Choose a reason for hiding this comment

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

LGTM

@ZzSean ZzSean merged commit 288ad84 into PaddlePaddle:develop Mar 23, 2023
@Bobholamovic Bobholamovic deleted the dev/fp16 branch March 23, 2023 03:00
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.

2 participants