mseth10 commented on a change in pull request #19543:
URL: https://github.com/apache/incubator-mxnet/pull/19543#discussion_r524818128
##########
File path: python/mxnet/gluon/block.py
##########
@@ -1271,33 +1297,44 @@ def hybridize(self, active=True, backend=None,
backend_opts=None, clear=True, pa
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
- partition_if_dynamic : bool
+ clear : bool, default True
+ clears any previous optimizations
+ partition_if_dynamic : bool, default False
whether to partition the graph when dynamic shape op exists
static_alloc : bool, default False
Statically allocate memory to improve speed. Memory usage may
increase.
static_shape : bool, default False
Optimize for invariant input shapes between iterations. Must also
set static_alloc to True. Change of input shapes is still allowed
but slower.
+ inline_limit : optional int, default 2
+ Maximum number of operators that can be inlined.
+ forward_bulk_size : optional int, default None
+ Segment size of bulk execution during forward pass.
+ backward_bulk_size : optional int, default None
+ Segment size of bulk execution during forward pass.
"""
- self._backend = backend
- if backend_opts is not None:
- assert isinstance(backend_opts, dict), \
- "HybridBlock hybridize requires backend_opts to be a dictionary."
- self._backend_opts = backend_opts
-
self._active = active
self._partition_if_dynamic = partition_if_dynamic
- self._flags = list(kwargs.items())
+ self._flags = [("static_alloc", static_alloc), ("static_shape",
static_shape),
+ ("inline_limit", inline_limit)]
+ if forward_bulk_size is not None:
+ self._flags.append(("forward_bulk_size", forward_bulk_size))
+ if backward_bulk_size is not None:
+ self._flags.append(("backward_bulk_size", backward_bulk_size))
if clear:
Review comment:
We always want to clear cachedop for hybridize now. We can remove
`clear` from the args list to hybridize.
----------------------------------------------------------------
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]