-
Notifications
You must be signed in to change notification settings - Fork 456
Description
First off, thanks for a great project! I use it all the time, and this is one of the first errors I've seen.
Describe the bug
When attempting to convert a graphdef squeezenet model to onnx (https://storage.googleapis.com/download.tensorflow.org/models/tflite/model_zoo/upload_20180427/squeezenet_2018_04_27.tgz)
If I use a static input shape:
python3 -m tf2onnx.convert --opset 11 --graphdef squeezenet.pb --inputs "Placeholder:0[1,224,224,3]" --outputs "softmax_tensor:0,ArgMax:0" --output squeezenet.onnx
I get a Softmax op at the end of the ONNX graph that takes a 2D input from the Flatten op. As expected, the onnx model has axis=1 on the softmax op.
If I leave the input shape unspecified:
python3 -m tf2onnx.convert --opset 11 --graphdef squeezenet.pb --inputs "Placeholder:0" --outputs "softmax_tensor:0,ArgMax:0" --output squeezenet.onnx
I get exactly the same graph structure, but axis=2 in the Softmax op. This is outside the onnx spec for softmax, which states -r <= axis < r, and so the model fails to execute with onnxruntime.
Urgency
None
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 20.04
- Tensorflow Version: tried on 2.2, 2.6
- Python version: Tried on 3.6, 3.7, 3.8
- TF2ONNX: Tried on 1.9.1, 1.9.2, tf2onnx-1.10.0-py3-none-any.whl sha256=fc193b2de660df427b2b2c8aaff163d7c33ffce7aa20ea93bd0f707b1f334a2b
To Reproduce
File and tf2onnx commands listed above, axis issue can be seen by loading the resulting onnx files in Netron.
Thank you!