onnx / tensorflow-onnx

Convert TensorFlow, Keras, Tensorflow.js and Tflite models to ONNX
Apache License 2.0
2.33k stars 432 forks source link

Input tensor to ExpandDims is lost when ExpandDims is in first layer of the input model. #2265

Open ArmDude opened 1 year ago

ArmDude commented 1 year ago

I came across this issue while attempting to convert Meta's Wav2Letter model to .onnx format. From some preliminary investigation, it seems that in cases where a model has the ExpandDims operator in the first layer with a provided preset tensor as input, this tensor input gets lost and is instead converted to an input to the entire model with an "Unsqueeze" operator in the .onnx output to replace the dimension expansion operation. This means that the tensor data for that ExpandDims operation is lost and needs to be manually supplied as an input by extracting the values from the original TensorFlow model.

fatcat-z commented 1 year ago

Thanks for your findings. Is it possible for you to update a simple demo for a repro?