apache / mxnet

Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more
https://mxnet.apache.org
Apache License 2.0
20.78k stars 6.79k forks source link

Floating Point Exception mxnet.ndarray.contrib.bipartite_matching #18927

Closed leeyeetonn closed 4 years ago

leeyeetonn commented 4 years ago

Description

(A clear and concise description of what the bug is.)

input = mx.nd.array(np.random.rand(0,2)) mx.ndarray.contrib.bipartite_matching(input, threshold=0.1)

gives:
>Floating point exception (core dumped)

If swap the position of the 0 in shape, it gives `dmlc::Error` instead:
```python
import mxnet as mx
import numpy as np

input = mx.nd.array(np.random.rand(2,0))
mx.ndarray.contrib.bipartite_matching(input, threshold=0.1)

gives:

terminate called after throwing an instance of 'dmlc::Error' what(): [22:15:23] src/imperative/./imperative_utils.h:146: Operator _contrib_bipartite_matching inferring shapes failed. input shapes: [2,-1] output shapes: [2] [-1] operator attributes: threshold : 0.1 Stack trace: [bt] (0) /root/miniconda3/lib/python3.7/site-packages/mxnet/libmxnet.so(+0x307d3b) [0x7f5828e96d3b] [bt] (1) /root/miniconda3/lib/python3.7/site-packages/mxnet/libmxnet.so(mxnet::imperative::SetShapeType(mxnet::Context const&, nnvm::NodeAttrs const&, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> > const&, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> > const&, mxnet::DispatchMode*)+0x363b) [0x7f582c0323bb] Aborted (core dumped)

Steps to reproduce

(Paste the commands you ran that produced the error.)

  1. run the above code snippets in python Interpreter or run it as a python script

What have you tried to solve it?

1. 2.

Environment

We recommend using our script for collecting the diagnositc information. Run the following command and paste the outputs below:

curl --retry 10 -s https://raw.githubusercontent.com/dmlc/gluon-nlp/master/tools/diagnose.py | python

# paste outputs here

I got 404 when trying to get the script.

Some environment information:

github-actions[bot] commented 4 years ago

Welcome to Apache MXNet (incubating)! We are on a mission to democratize AI, and we are glad that you are contributing to it by opening this issue. Please make sure to include all the relevant context, and one of the @apache/mxnet-committers will be here shortly. If you are interested in contributing to our project, let us know! Also, be sure to check out our guide on contributing to MXNet and our development guides wiki.

szha commented 4 years ago

See the above PR for the fix.