samskalicky opened a new issue #12555: Operator registration does not check for 
keyword sensitivity
URL: https://github.com/apache/incubator-mxnet/issues/12555
 
 
   When registering an operator there are a set of keywords that cannot be 
specified in various places throughout the registration process. One example is 
adding an argument named "name" builds fine but on importing in python results 
in this error:
   
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/home/ubuntu/engine_arch/python/mxnet/__init__.py", line 28, in 
<module>
        from . import contrib
     File "/home/ubuntu/engine_arch/python/mxnet/contrib/__init__.py", line 27, 
in <module>
        from . import autograd
     File "/home/ubuntu/engine_arch/python/mxnet/contrib/autograd.py", line 29, 
in <module>
        from ..ndarray import NDArray, zeros_like, _GRAD_REQ_MAP
     File "/home/ubuntu/engine_arch/python/mxnet/ndarray/__init__.py", line 26, 
in <module>
        from . import register
     File "/home/ubuntu/engine_arch/python/mxnet/ndarray/register.py", line 
169, in <module>
        _init_op_module('mxnet', 'ndarray', _make_ndarray_function)
     File "/home/ubuntu/engine_arch/python/mxnet/base.py", line 629, in 
_init_op_module
        function = make_op_func(hdl, name, func_name)
     File "/home/ubuntu/engine_arch/python/mxnet/ndarray/register.py", line 
162, in _make_ndarray_function
        exec(code, None, local)  # pylint: disable=exec-used
     File "<string>", line 2
        SyntaxError: duplicate argument 'name' in function definition
   
   Here is the example operator registration:
   
   ```
   NNVM_REGISTER_OP(min_ex)
   .describe("some description")
   .set_num_inputs(1)
   .add_argument("name", "int", "description")
   .set_num_outputs(1)
   .set_attr<nnvm::FInferShape>("FInferShape", MinExOpShape)
   .set_attr<nnvm::FInferType>("FInferType", MinExOpType)
   .set_attr<FCompute>("FCompute<cpu>", MinExForward);
   ```
   
   We should probably add upfront checks, or at least clean up the runtime 
failure messages so they are more clear, in addition to better documenting 
keywords to avoid.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to