Skip to content

Conversation

zoooo0820
Copy link
Contributor

@zoooo0820 zoooo0820 commented Dec 12, 2023

PR types

New features

PR changes

Others

Description

Pcard-66985

support __getitem__ and __setitem__ in PIR

Copy link

paddle-bot bot commented Dec 12, 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.

@@ -244,6 +278,7 @@ def foo(x, H, W):
pad_list[1] = W // 2

x = F.pad(x, pad_list, data_format="NHWC")
breakpoint()
Copy link
Member

Choose a reason for hiding this comment

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

这里忘删了

SigureMo
SigureMo previously approved these changes Dec 19, 2023
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow

0x45f
0x45f previously approved these changes Dec 19, 2023
orig_name,
phi::errors::PreconditionNotMet(
"SetParamer param name should not equal with var name"));
if (param_name == orig_name) {
Copy link
Contributor

Choose a reason for hiding this comment

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

什么场景下会出现param_name == orig_name的情况?

Copy link
Contributor

Choose a reason for hiding this comment

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

Program中有两条set parameter 语句:
setparameter value1 output1
setparameter value1 output1
就会触发这个检查。

就是对同一个 value,进行了两次set parameter,他们的名字相同。

@zoooo0820 zoooo0820 dismissed stale reviews from 0x45f and SigureMo via b583923 December 19, 2023 06:29
self.father[father_x] = father_y

def find_root(self, x):
if not self.father.__contains__(x):
Copy link
Member

Choose a reason for hiding this comment

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

这里应该直接用原来的 in 也没关系吧,self.father 已经是 ValueDict 了,重写了 __contains__,应该已经是安全的, @0x45f 觉得呢?

只是写法问题,本 PR 不改也没关系

Copy link
Contributor

Choose a reason for hiding this comment

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

这里我理解原来的写法也是可以的,但是目前的写法也没有问题~

@@ -80,7 +81,7 @@ def get(self, program, value):
return None
root_var = inplace_dict[value]
saved = []
while root_var in inplace_dict.keys():
while inplace_dict.__contains__(root_var):
Copy link
Member

Choose a reason for hiding this comment

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

同上

Copy link
Contributor

Choose a reason for hiding this comment

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

这里原来的写法需要修改为root_var in inplace_dict,需要去掉keys(),因为原来的写法相当于是 x in list这种用法,是禁止的~

@jeff41404 jeff41404 merged commit 0d2c1eb into PaddlePaddle:develop Dec 20, 2023
@zoooo0820 zoooo0820 deleted the support_pir_for_python_get_set branch December 20, 2023 07:28
HermitSun pushed a commit to HermitSun/Paddle that referenced this pull request Dec 21, 2023
* support __getitem__ & __setitem__ in PIR

* dy2static consider inplace mapping.

* fix DtypeError in case15

* disable AST+PIR only

* add missing decorator test_legacy_and_pt_and_pir

* modify Py_Dict to ValueDict

* fix test_top_p

---------

Co-authored-by: xiongkun <xiongkun03@baidu.com>
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
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.

6 participants