TobiasSkovgaardJepsen opened a new issue #14177: Insufficient documentation for 
.hybridize()
URL: https://github.com/apache/incubator-mxnet/issues/14177
 
 
   Hi
   
   I have been trying to optimize my models with hybridize and accidentally 
misspelled an argument to the method. I got the quite interesting message below 
(using a minimal example):
   ```
   >>> from mxnet.gluon.nn import Dense
   >>> from mxnet.ndarray import ones
   >>> model = Dense(10)
   >>> X =ones((1, 10))
   >>> model.initialize()
   >>> model.hybridize(unsupported_keyword_argument=True))
   >>> model(X)
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File 
"/Users/tsj/.local/share/virtualenvs/rne-U4U7XVrs/lib/python3.6/site-packages/mxnet/gluon/block.py",
 line 542, in __call__
       out = self.forward(*args)
     File 
"/Users/tsj/.local/share/virtualenvs/rne-U4U7XVrs/lib/python3.6/site-packages/mxnet/gluon/block.py",
 line 909, in forward
       return self._call_cached_op(x, *args)
     File 
"/Users/tsj/.local/share/virtualenvs/rne-U4U7XVrs/lib/python3.6/site-packages/mxnet/gluon/block.py",
 line 799, in _call_cached_op
       self._build_cache(*args)
     File 
"/Users/tsj/.local/share/virtualenvs/rne-U4U7XVrs/lib/python3.6/site-packages/mxnet/gluon/block.py",
 line 787, in _build_cache
       self._cached_op = ndarray.CachedOp(out, flags)
     File 
"/Users/tsj/.local/share/virtualenvs/rne-U4U7XVrs/lib/python3.6/site-packages/mxnet/_ctypes/ndarray.py",
 line 116, in __init__
       ctypes.byref(self.handle)))
     File 
"/Users/tsj/.local/share/virtualenvs/rne-U4U7XVrs/lib/python3.6/site-packages/mxnet/base.py",
 line 251, in check_call
       raise MXNetError(py_str(_LIB.MXGetLastError()))
   mxnet.base.MXNetError: Cannot find argument 'erroneous_keyword_argument', 
Possible Arguments:
   
   ----------------
   static_alloc : boolean, optional, default=0
       Statically allocate memory to improve speed. Memory usage may increase.
   static_shape : boolean, optional, default=0
       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 : int (non-negative), optional, default=2
       Maximum number of operators that can be inlined.
   forward_bulk_size : int (non-negative), optional, default=15
       Segment size of bulk execution during forward pass.
   backward_bulk_size : int (non-negative), optional, default=15
       Segment size of bulk execution during backward pass.
   data_indices : tuple of <int (non-negative)>, optional, default=[]
       Position of argument variables.
   param_indices : tuple of <int (non-negative)>, optional, default=[]
       Position of parameters.
   ```
   
   Although I find this message quite useful, I also found it quite surprising 
since [the 
documentation](https://mxnet.incubator.apache.org/versions/master/api/python/gluon/gluon.html?highlight=hybrid#mxnet.gluon.Block.hybridize)
 only mentions `static_alloc` and `static_shape`.
   
   I am not sure what the effect of the other parameters are and when they are 
appropriate to change. I am hoping that someone could tell me and I suggest 
that the documentation be updated to describe the undocumented keyword 
arguments.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to