Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It's natural to express the dynamic models in frameworks with the imperative programming interface (e.g., Gluon, PythonPytorch, TensorFlow Eager). In this interface, users can simply use Python control flows, or NDArrays with any shape at any moment, or use Python lists and dictionaries to store data as they want.

...

  • We can execute the subgraph outside the execution engine in the main thread like a normal function call. In this way, the data in the output arrays of a control flow operator is only marked valid by the operators in the subgraph. In the case of ``cond’’ and ``while_loop’’, we need to wait for the condition subgraph to complete before we can proceed with ``then_func'' or ``else_func'' or the loop body. Potentially, we can still wait in the main thread for the condition subgraph to complete. However, blocking the main thread prevents multiple-GPU parallelism (MXNet has a single execution thread and uses asynchronous execution for multiple-GPU parallelism). As such, we have to allow the subgraph execution in the threaded engine.

...