-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
refactor rnn infershape #4553
refactor rnn infershape #4553
Conversation
paddle/operators/recurrent_op.cc
Outdated
rnn::SegmentInputs(step_scopes, arg_->inlinks, seq_len_); | ||
InitMemories(step_scopes[0]); | ||
|
||
for (size_t i = 0; i < seq_len_; i++) { |
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.
i -> stepid
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
(output->Slice<float>(j, j + 1)) | ||
.CopyFrom<float>(*step_output, platform::CPUPlace()); | ||
} | ||
auto step_scope_var = step_scopes[0]->FindVar(outlinks[i]); |
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.
auto*
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
paddle/operators/recurrent_op.cc
Outdated
@@ -146,23 +144,22 @@ class RecurrentAlgorithmProtoAndCheckerMaker | |||
|
|||
void RecurrentGradientAlgorithm::Run( | |||
const Scope& scope, const platform::DeviceContext& dev_ctx) const { | |||
seq_len_ = | |||
scope.FindVar(arg_->inlinks[0])->GetMutable<LoDTensor>()->dims()[0]; |
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.
enforce not null scope.FindVar
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
fix: #4555