leezu commented on a change in pull request #17530: Add deferred compute support URL: https://github.com/apache/incubator-mxnet/pull/17530#discussion_r386650044
########## File path: src/imperative/imperative.cc ########## @@ -273,7 +288,153 @@ void Imperative::RecordOp( info.outputs.back().dtype_ = outputs[i]->dtype(); info.outputs.back().storage_type_ = outputs[i]->storage_type(); } - outputs[i]->entry_ = nnvm::NodeEntry{node, i, 0}; + outputs[i]->autograd_entry_ = nnvm::NodeEntry{node, i, 0}; + } +} + +void Imperative::RecordDeferredCompute(nnvm::NodeAttrs &&attrs, + const std::vector<NDArray *> &inputs, + const std::vector<NDArray *> &outputs) { + CHECK(!is_recording()) + << "Autograd recording is not supported during deferred compute mode."; + + for (const NDArray *output : outputs) { + CHECK(DCInfo::IsNone(*output)) + << "Inplace operations (+=, -=, x[:]=, etc) are not supported when " + << "recording in deferred compute mode."; + // However, an inplace operation on a non-deferred compute array inside Review comment: Correct. In the first case we just record `_slice_assign_scalar` Op. The second case is unsupported because the `output` of `_slice_assign_scalar` is a ndarray that already has a `deferredcompute_entry_` attribute. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services