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

tf2onnx 1.14 - wrong conversion of BatchNormalization

Open svobora opened this issue 2 years ago • 1 comments

using "tf2onnx.convert.from_function" on lambda with Keras model,

tf2onnx 1.13 - works ok, batch normalization layer has members "mean" and "var" tf2onnx 1.14 - batch normalization layer has members "input_mean" and "input_var" instead of "mean" and "var".

In both cases package onnx has version 1.13.1.

.onnx file converted with 1.14 thus cannot be used to generate TensorRT file.

image

svobora avatar Mar 29 '23 07:03 svobora

This is by design.

For BatchNormalization op, the names of these 2 inputs were changed since opset 14. You can check the difference between opset 9 and 14 from here.

Since tf2onnx 1.14, we changed the default opset from 13 to 15 so such changes happend to this op. If you want to keep the previous behavior, please use '--opset' parameter while converting a model to ONNX.

fatcat-z avatar May 12 '23 07:05 fatcat-z