tensorflow-onnx icon indicating copy to clipboard operation
tensorflow-onnx copied to clipboard

tranpose optimization for hardswish in tensorflow-lite

Open Xiadalei opened this issue 3 years ago • 4 comments

Describe the bug When convering a tensorflow lite model with hardswish, specifically TFL_HARD_SWISH operator. There's tranpose wrapper around the hardswish operator.

before conversion 图片

after conversion 图片

Urgency none

System information

  • OS Platform and Distribution: Linux Ubuntu 20.04
  • Tensorflow Version: 2.6.0
  • Python version: 3.8.10

To Reproduce

Just use offical mobileV3 model or use the model below v3-small_224_1.0_float.tflite.zip with command line python -m tf2onnx.convert --tflite ./v3-small_224_1.0_float.tflite --inputs-as-nchw input --opset 14 --output ./v3.onnx

And the model converted is v3.zip

Xiadalei avatar Jan 04 '22 03:01 Xiadalei

I don't find the same shape Conv2d op with the model graph you provide. Could you also check the model and send the repro conversion code?

hwangdeyu avatar Jan 06 '22 09:01 hwangdeyu

I don't find the same shape Conv2d op with the model graph you provide. Could you also check the model and send the repro conversion code?

Sorry for the confusion that the pic was not from the model I uploaded. Now the question is rectified with model I converted. Also the conversion is conducted in cli with command like python -m tf2onnx.convert --tflite ./v3-small_224_1.0_float.tflite --inputs-as-nchw input --opset 14 --output ./v3.onnx You can reproduce the described issue with that step.

Xiadalei avatar Jan 06 '22 09:01 Xiadalei

I don't find the same shape Conv2d op with the model graph you provide. Could you also check the model and send the repro conversion code?

Sorry for the confusion that the pic was not from the model I uploaded. Now the question is fixed with model I converted. Also the conversion is conducted in cli with command like python -m tf2onnx.convert --tflite ./v3-small_224_1.0_float.tflite --inputs-as-nchw input --opset 14 --output ./v3.onnx

Thanks, I closed this issue cause the question is fixed.

hwangdeyu avatar Jan 10 '22 02:01 hwangdeyu

I don't find the same shape Conv2d op with the model graph you provide. Could you also check the model and send the repro conversion code?

Sorry for the confusion that the pic was not from the model I uploaded. Now the question is fixed with model I converted. Also the conversion is conducted in cli with command like python -m tf2onnx.convert --tflite ./v3-small_224_1.0_float.tflite --inputs-as-nchw input --opset 14 --output ./v3.onnx

Thanks, I closed this issue cause the question is fixed.

The fixed problem I refered to is not using the same model. The problem with tranposing still exists. Could you reopen the issue? @hwangdeyu

Xiadalei avatar Jan 10 '22 06:01 Xiadalei