-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[PIR]Perfect unittest for assign / softmax_mask_fuse_upper_triangle / tile / tril_triu / pad #58026
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 get_attr_repeat_times(list_repeat_times): | ||
attrs_repeat_times = [] | ||
for idx, times in enumerate(list_repeat_times): | ||
if isinstance(times, Variable): | ||
if isinstance(times, (Variable, paddle.pir.OpResult)): |
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.
在非pir的分支下也会出现OpResult
类型吗?
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.
不会,下个PR删一下
@@ -288,6 +290,7 @@ def test_errors(self): | |||
self.assertRaises(TypeError, paddle.assign, x2) | |||
paddle.disable_static() | |||
|
|||
@test_with_pir_api | |||
def test_type_error(self): | |||
paddle.enable_static() | |||
with program_guard(Program(), Program()): |
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.
这个地方Program是base 引入的,可能还是旧的program, 可以检查一下
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.
这里应该是旧Program,下个pr重新修改一下这个单测
@@ -275,6 +276,7 @@ def test_assign_bfp16(self): | |||
|
|||
|
|||
class TestAssignOpErrorApi(unittest.TestCase): | |||
@test_with_pir_api | |||
def test_errors(self): | |||
paddle.enable_static() | |||
with program_guard(Program(), Program()): |
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.
同下
@@ -105,6 +105,18 @@ def test_assign(self): | |||
np.testing.assert_array_equal(fetched_x, self.value) | |||
self.assertEqual(fetched_x.dtype, self.value.dtype) | |||
|
|||
def test_pir_assign(self): | |||
with paddle.pir_utils.IrGuard(): |
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.
在guard 中使用paddle.static.Program() 便于后续静态图退场统一入口
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.
好的,谢谢
@@ -107,7 +111,7 @@ def test_static(self): | |||
|
|||
exe = base.Executor(base.CUDAPlace(0)) | |||
fetches = exe.run( | |||
base.default_main_program(), | |||
paddle.static.default_main_program(), |
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.
guard中是paddle.static.program(). 这里执行默认的program是同一个吗?
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.
是的
… tile / tril_triu / pad (PaddlePaddle#58026) * compact unittest * fix windows bugs * fix bugs * modify code * fix mkldnn
… tile / tril_triu / pad (PaddlePaddle#58026) * compact unittest * fix windows bugs * fix bugs * modify code * fix mkldnn
PR types
Others
PR changes
Others
Description
Pcard-67164
补全如下算子的新IR单测,并解决单测验证中出现的问题:
assign / softmax_mask_fuse_upper_triangle / tile / tril_triu / pad