Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

fix a bug in CachedOp. #11675

Merged
merged 5 commits into from
Jul 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/imperative/imperative_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -963,13 +963,13 @@ inline void CreateEngineOpSeg(
seg_execs.push_back(exec);

auto& seg = (*opr_segs)[nid];
if (is_async) {
seg = EngineOprSeg{false, nid + 1};
seg.opr.reset(CreateEngineOp(default_ctx, seg_execs));
if (!valid) {
seg = EngineOprSeg{false, nid + 1, nullptr};
seg_execs.clear();
seg_start = nid + 1;
} else if (!valid) {
seg = EngineOprSeg{false, nid + 1, nullptr};
} else if (is_async) {
seg = EngineOprSeg{false, nid + 1};
seg.opr.reset(CreateEngineOp(default_ctx, seg_execs));
seg_execs.clear();
seg_start = nid + 1;
Copy link
Member

Choose a reason for hiding this comment

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

extract common code outside branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can't. the code is used in "if" and "else if". it's not used in "else"

}
Expand Down
Loading