szha commented on a change in pull request #11951: [MXNET-750] fix nested call
on CachedOp.
URL: https://github.com/apache/incubator-mxnet/pull/11951#discussion_r206601278
##########
File path: src/imperative/cached_op.cc
##########
@@ -821,12 +821,11 @@ OpStatePtr CachedOp::DynamicForward(
const auto& dispatch_modes = g.GetAttr<DispatchModeVector>("dispatch_mode");
- if (recording && !inlining_) Imperative::Get()->set_is_recording(false);
-
+ // We don't need to record when running the graph. The computation is
recorded
+ // in forward.
RunGraph(false, idx, arrays, 0, idx.num_nodes(), std::move(array_reqs),
- std::move(ref_count), &states, dispatch_modes);
-
- Imperative::Get()->set_is_recording(recording);
+ std::move(ref_count), &states, dispatch_modes,
+ recording && !inlining_ ? false : true);
Review comment:
this is equivalent to `!recording || inlining_`. is this right?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services