Kh4L opened a new pull request #19386:
URL: https://github.com/apache/incubator-mxnet/pull/19386
## Description ##
`symbol.optimize_for` backend options are given as kwargs but the
`block.optimize_for` ones are given as a separate `backend_opts` dict.
We end up with an API discrepancy, than can be confusing for the user.
Here's an exemple:
#### Symbol
```
sym.optimize_for(backend, args, reqArgs=True, dedup_subgraph=True)```
```
#### Block (Gluon)
```
blk.optimize_for(x, backend="addInputPass", clear=False,
backend_opts={'dedup_subgraph':True})
```
This limitation was due to preserve the kwargs from hybridize.
However this kwargs is virtually only used to forward the `static_alloc` and
`static_shape` arguments.
## Change
This PR factors out `static_alloc` and `static_shape` and changes the
`kwargs`.
### Example after the change:
```
blk.optimize_for(x, backend="addInputPass", clear=False,
backend_opts={'dedup_subgraph':True})
```
will be now called as
```
blk.optimize_for(x, backend="addInputPass", clear=False, dedup_subgraph=True)
```
Note: if needed in the future, we can add an `extra_hybridize_kwargs`.
----------------------------------------------------------------
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]