-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Impl optimizer #4734
Impl optimizer #4734
Conversation
… impl-optimizer
… impl-optimizer
… impl-optimizer
… impl-optimizer
… impl-optimizer
… impl-optimizer
… python-cpp-sync
… impl-optimizer
… into impl-optimizer
… impl-optimizer
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.
Excellent!
@@ -298,6 +302,9 @@ static void CreateGradVarInBlock( | |||
grad_record.op_idx_ = static_cast<int>(op_index); | |||
return false; /* not break */ | |||
}); | |||
if (need_infer_shape) { |
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.
Cool.
@@ -305,6 +305,11 @@ def parent_idx(self): | |||
def idx(self): | |||
return self.desc.id | |||
|
|||
def var(self, name): | |||
if name not in self.vars: | |||
raise Exception("var %s not in this block" % 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.
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
@@ -313,7 +318,9 @@ def has_var(self, name): | |||
|
|||
def create_parameter(self, *args, **kwargs): | |||
global_block = self.program.global_block() | |||
return Parameter(global_block, *args, **kwargs) | |||
param = Parameter(global_block, *args, **kwargs) | |||
self.program.parameters.append(param.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.
parameters
is not needed because it is recorded in vars_
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
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
Project: #4679
Issue: #4735