-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
complex No.15 sqrt op #57661
Closed
Closed
complex No.15 sqrt op #57661
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bcd1b16
complex sqrt op
yangguohao 07d7182
fix
yangguohao 53fbc3d
Merge branch 'develop' into complex_sqrt
yangguohao 62cb1a8
Merge branch 'PaddlePaddle:develop' into complex_sqrt
yangguohao cda1638
Merge branch 'PaddlePaddle:develop' into complex_sqrt
yangguohao 2e9afec
fix codestyle
yangguohao 236fdba
Merge branch 'PaddlePaddle:develop' into complex_sqrt
yangguohao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1514,7 +1514,13 @@ def setUp(self): | |
self.if_enable_cinn() | ||
|
||
np.random.seed(1023) | ||
x = np.random.uniform(0.1, 1, self.shape).astype(self.dtype) | ||
if self.dtype is np.complex64 or self.dtype is np.complex128: | ||
x = ( | ||
np.random.uniform(0.1, 1, self.shape) | ||
+ 1j * np.random.uniform(0.1, 1, self.shape) | ||
).astype(self.dtype) | ||
else: | ||
x = np.random.uniform(0.1, 1, self.shape).astype(self.dtype) | ||
out = np.sqrt(x) | ||
|
||
self.inputs = {'X': OpTest.np_dtype_to_base_dtype(x)} | ||
|
@@ -1527,16 +1533,37 @@ def if_enable_cinn(self): | |
def test_check_grad(self): | ||
if self.dtype == np.float16: | ||
return | ||
self.check_grad( | ||
['X'], | ||
'Out', | ||
check_prim=True, | ||
check_pir=True, | ||
check_prim_pir=True, | ||
) | ||
if self.dtype not in [np.complex64, np.complex128]: | ||
self.check_grad( | ||
['X'], | ||
'Out', | ||
check_prim=True, | ||
check_pir=True, | ||
check_prim_pir=True, | ||
) | ||
else: | ||
self.check_grad( | ||
['X'], | ||
'Out', | ||
) | ||
|
||
def test_check_output(self): | ||
self.check_output(check_prim=True, check_pir=True, check_prim_pir=True) | ||
if self.dtype not in [np.complex64, np.complex128]: | ||
self.check_output( | ||
check_prim=True, check_pir=True, check_prim_pir=True | ||
) | ||
else: | ||
self.check_output() | ||
|
||
|
||
class TestSqrtComplex64(TestSqrt): | ||
def init_dtype(self): | ||
self.dtype = np.complex64 | ||
|
||
|
||
class TestSqrtComplex128(TestSqrt): | ||
def init_dtype(self): | ||
self.dtype = np.complex128 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 看下这两个单测是否跑进去了,如果跑进去的话,贴一个截图上来 |
||
|
||
|
||
class TestSqrtPrimFp32(TestActivation): | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
为什么要修改这里的 op test呢
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.
因为 OpTest 里应该是没有高阶导的测试,而这里的判断就避免 dfs 函数搜到高阶 grad op_desc。