ptrendx commented on a change in pull request #20462:
URL: https://github.com/apache/incubator-mxnet/pull/20462#discussion_r673472678
##########
File path: src/imperative/cached_op.cc
##########
@@ -989,7 +991,12 @@ void CachedOp::StaticBackward(
auto entry = state.info.grad_graph.outputs[iter->second];
if (!idx.exist(entry.node.get())) continue;
auto eid = idx.entry_id(entry);
- state.array_reqs[eid] = reqs[iter->second];
+ // if ref count is not 0, then we should not assign req user provide
+ if (reqs[iter->second] == kNullOp && !(ref_count[eid] == 0)) {
+ state.array_reqs[eid] = kWriteTo;
Review comment:
A question, since I do not really know - do we need to put `kWriteTo`
here? I think it should be handled by the memory pass later on, right?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]