## Description
Generate Python wrapper for operators in the NDArray APIs do not have the 
correct function declaration (argument list). 

## Error Message:
`Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 59, in softmax
  File 
"/Users/sskalic/projects/mxnet/sskalic_branch5/python/mxnet/_ctypes/ndarray.py",
 line 92, in _imperative_invoke
    ctypes.byref(out_stypes)))
  File "/Users/sskalic/projects/mxnet/sskalic_branch5/python/mxnet/base.py", 
line 252, in check_call
    raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [17:09:02] 
src/c_api/../imperative/imperative_utils.h:336: Check failed: num_inputs == 
infered_num_inputs (0 vs. 1) Operator softmax expects 1 inputs, but got 0 
instead.

Stack trace returned 7 entries:
[bt] (0) 0   libmxnet.so                         0x0000000103e98ae6 
dmlc::StackTrace() + 1238
[bt] (1) 1   libmxnet.so                         0x0000000103e984d5 
dmlc::LogMessageFatal::~LogMessageFatal() + 53
[bt] (2) 2   libmxnet.so                         0x0000000103e94655 
dmlc::LogMessageFatal::~LogMessageFatal() + 21
[bt] (3) 3   libmxnet.so                         0x00000001067a895c 
mxnet::imperative::SetNumOutputs(nnvm::Op const*, nnvm::NodeAttrs const&, int 
const&, int*, int*) + 988
[bt] (4) 4   libmxnet.so                         0x00000001067a5612 
MXImperativeInvokeImpl(void*, int, void**, int*, void***, int, char const**, 
char const**) + 210
[bt] (5) 5   libmxnet.so                         0x00000001067a8e08 
MXImperativeInvokeEx + 184
[bt] (6) 6   _ctypes.so                          0x000000010319a7b7 
ffi_call_unix64 + 79
`

The expected error message should be of the form:

`
TypeError: softmax() takes exactly # arguments (0 given)
`

## Minimum reproducible example
`
import mxnet as mx
mx.nd.softmax()
`

## Steps to reproduce
Execute above code

## What have you tried to solve it?
There is a deep underlying problem with the way we generate wrappers 
"on-the-fly". Heres an example:

`# generic/unsafe function definition                                           
                              
def sam1(*args, **kwargs):
    print(args)
    print(kwargs)

# specific function definition                                                  
                             
def sam2(size,joe):
    print(size)
    print(joe)

#valid function calls                                                           
                             
sam1(2,joe=4)
sam2(2,joe=4)

#invalid function calls that do not fail                                        
                             
sam1(1,2,3)
sam1(2,bob=4)

# invalid function calls that do fail                                           
                             
try:
    sam2(1,2,3)
except TypeError as e:
    print('Dont do that! ',e)

try:
    sam2(2,bob=4)
except TypeError as e:
    print('Dont do that! ',e)
`



[ Full content available at: 
https://github.com/apache/incubator-mxnet/issues/12286 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to