You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/07/29 07:36:16 UTC

[GitHub] [incubator-mxnet] samskalicky commented on a change in pull request #18779: [WIP] Support extra inputs for subgraph ops

samskalicky commented on a change in pull request #18779:
URL: https://github.com/apache/incubator-mxnet/pull/18779#discussion_r461313717



##########
File path: python/mxnet/gluon/block.py
##########
@@ -1225,6 +1226,7 @@ def hybridize(self, active=True, backend=None, backend_opts=None, **kwargs):
             The name of backend, as registered in `SubgraphBackendRegistry`, default None
         backend_opts : dict of user-specified options to pass to the backend for partitioning, optional
             Passed on to `PrePartition` and `PostPartition` functions of `SubgraphProperty`
+        clear : clears any previous optimizations

Review comment:
       Yes, Previously hybridize used to clear the cachedOp and cached_graph on every call. In this PR we add a new argument clear that defaults to True to preserve current behavior. When set to False it allows re-using the previous cached_graph to chain multiple optimization calls together. Heres an example:
   ```
   net = nn.SymbolBlock(sym, inputs)
   net.optimize_for(x, backend="opt1")
   net.optimize_for(x, backend="opt2", clear=False)
   ```

##########
File path: python/mxnet/gluon/block.py
##########
@@ -1225,6 +1226,7 @@ def hybridize(self, active=True, backend=None, backend_opts=None, **kwargs):
             The name of backend, as registered in `SubgraphBackendRegistry`, default None
         backend_opts : dict of user-specified options to pass to the backend for partitioning, optional
             Passed on to `PrePartition` and `PostPartition` functions of `SubgraphProperty`
+        clear : clears any previous optimizations

Review comment:
       Maybe the 1st call to `optimize_for` is to partition the graph, and the 2nd call would be to run a custom graph pass for example. 




----------------------------------------------------------------
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:
users@infra.apache.org