leezu commented on a change in pull request #17530: Add deferred compute support
URL: https://github.com/apache/incubator-mxnet/pull/17530#discussion_r384153607
##########
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:
This context is only used as `default_ctx`. (Also, this line is not changed
in this PR.)
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services