-
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
[D2SCinn]Fix self.infer_program always build cinn pass without cache #49696
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -280,23 +280,32 @@ def _train_program(self): | |||
|
|||
@LazyInitialized | |||
def _infer_program(self): | |||
return self._create_program(is_infer_mode=True) | |||
program = self._create_program(is_infer_mode=True) |
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,可以调用self._create_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.
LGTM
@@ -317,62 +346,6 @@ def _train_pure_fp16_forward_backward_program(self): | |||
program = self._create_forward_backward_train_pure_fp16_program() | |||
return program | |||
|
|||
@property | |||
def whole_program(self): | |||
if self.training: |
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重复了
return names | ||
|
||
@property | ||
def whole_program_id(self): |
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_id重复了
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.
LGTM
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.
LGTM
PR types
Function optimization
PR changes
APIs
Describe
优化了 self.infer_program 在每次被调用时都会重复的_build_infer_program,导致性能下降。
将_build_infer_program 逻辑下放到 self._XX 函数中。因为已经提供了self._create_XXX_program接口获取原生的program,因此此处采取了当前方案。