CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Support pir for python get set #59928
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
Support pir for python get set #59928
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -244,6 +278,7 @@ def foo(x, H, W): | |||
pad_list[1] = W // 2 | |||
|
|||
x = F.pad(x, pad_list, data_format="NHWC") | |||
breakpoint() |
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.
这里忘删了
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.
orig_name, | ||
phi::errors::PreconditionNotMet( | ||
"SetParamer param name should not equal with var name")); | ||
if (param_name == orig_name) { |
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.
什么场景下会出现param_name == orig_name的情况?
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中有两条set parameter 语句:
setparameter value1 output1
setparameter value1 output1
就会触发这个检查。
就是对同一个 value,进行了两次set parameter,他们的名字相同。
self.father[father_x] = father_y | ||
|
||
def find_root(self, x): | ||
if not self.father.__contains__(x): |
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.
这里应该直接用原来的 in 也没关系吧,self.father
已经是 ValueDict
了,重写了 __contains__
,应该已经是安全的, @0x45f 觉得呢?
只是写法问题,本 PR 不改也没关系
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.
这里我理解原来的写法也是可以的,但是目前的写法也没有问题~
@@ -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): |
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.
同上
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.
这里原来的写法需要修改为root_var in inplace_dict
,需要去掉keys(),因为原来的写法相当于是 x in list
这种用法,是禁止的~
* 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>
PR types
New features
PR changes
Others
Description
Pcard-66985
support
__getitem__
and__setitem__
in PIR