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

support view strategy in dygraph eager_final state #40891

Merged
merged 20 commits into from
Mar 30, 2022

Conversation

pangyoki
Copy link
Contributor

@pangyoki pangyoki commented Mar 24, 2022

PR types

New features

PR changes

Others

Describe

为新动态图最终态添加View机制:reshapesqueezeunsqueezeflatten
目前只为reshape添加了view机制,等其他op的yaml文件ready了之后再添加view机制。

图片

@paddle-bot-old
Copy link

你的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.

@pangyoki pangyoki force-pushed the support_view_in_eager_final branch from b128578 to de41fed Compare March 26, 2022 16:09
zyfncg
zyfncg previously approved these changes Mar 29, 2022
inplace : (x -> out)
view: (x -> out)
intermediate : xshape
no_need_buffer: xshape
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的xshape需不需要使用no_need_buffer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

不需要使用no_need_buffer,已删除

Comment on lines 278 to 293
def parse_inplace_or_view(self, api_item_yaml, mode='inplace'):
if mode in api_item_yaml:
inplace_view_map = {}
in_out_mapping_list = api_item_yaml[mode].split(',')
for item in in_out_mapping_list:
result = re.search(r"(?P<in>\w+)\s*->\s(?P<out>\w+)", item)
in_val = result.group('in')
out_val = result.group('out')
assert in_val in self.inputs['names'], \
f"{self.api} : Inplace input error: the input var name('{in_val}') is not found in the input args of {self.api}."
f"{self.api} : {mode} input error: the input var name('{in_val}') is not found in the input args of {self.api}."
assert out_val in self.outputs['names'], \
f"{self.api} : Inplace output error: the output var name('{out_val}') is not found in the output args of {self.api}."
f"{self.api} : {mode} output error: the output var name('{out_val}') is not found in the output args of {self.api}."

inplace_map[out_val] = in_val
inplace_view_map[out_val] = in_val

return inplace_map
return inplace_view_map
Copy link
Contributor

Choose a reason for hiding this comment

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

这里感觉不传mode参数,直接一次返回inplace和view两个map看上去会更直观一些

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

YuanRisheng
YuanRisheng previously approved these changes Mar 29, 2022
@pangyoki pangyoki dismissed stale reviews from YuanRisheng and zyfncg via 1f90cfa March 29, 2022 12:04
@pangyoki pangyoki merged commit 495ca4a into PaddlePaddle:develop Mar 30, 2022
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.

4 participants