zhreshold commented on a change in pull request #17530: Add deferred compute support URL: https://github.com/apache/incubator-mxnet/pull/17530#discussion_r383590278
########## File path: src/c_api/c_api_ndarray.cc ########## @@ -107,9 +107,17 @@ void MXImperativeInvokeImpl(AtomicSymbolCreator creator, SetNDInputsOutputs(op, &ndinputs, &ndoutputs, num_inputs, inputs, num_outputs, infered_num_outputs, num_visible_outputs, outputs); - auto state = Imperative::Get()->Invoke(Context::CPU(), attrs, ndinputs, ndoutputs); - if (Imperative::Get()->is_recording()) { - Imperative::Get()->RecordOp(std::move(attrs), ndinputs, ndoutputs, state); + if (Imperative::Get()->is_deferred_compute()) { + Imperative::Get()->RecordDeferredCompute(std::move(attrs), ndinputs, ndoutputs); + } else { + for (NDArray* input : ndinputs) { + Imperative::DCInfo::Compute(*input); + } + auto state = Imperative::Get()->Invoke( + Context::CPU(), attrs, ndinputs, ndoutputs); Review comment: is it assumes the context is always CPU? ---------------------------------------------------------------- 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