-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
support view strategy in dygraph eager_final state #40891
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
b128578
to
de41fed
Compare
… support_view_in_eager_final
… support_view_in_eager_final
… support_view_in_eager_final
inplace : (x -> out) | ||
view: (x -> out) | ||
intermediate : xshape | ||
no_need_buffer: xshape |
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.
这里的xshape需不需要使用no_need_buffer?
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.
不需要使用no_need_buffer,已删除
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 |
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.
这里感觉不传mode参数,直接一次返回inplace和view两个map看上去会更直观一些
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.
done
PR types
New features
PR changes
Others
Describe
为新动态图最终态添加View机制:
reshape
、squeeze
、unsqueeze
、flatten
。目前只为
reshape
添加了view机制,等其他op的yaml文件ready了之后再添加view机制。