tensorflow-onnx
tensorflow-onnx copied to clipboard
Attribute new_axis_mask not supported
I am trying to convert model created from TensorFlow Object Detection API from saved_model.pb to Onnx format.
Unfortunately, next issue arrises: ValueError: StridedSlice: attribute new_axis_mask not supported
Here you can find my model either in saved_model and checkpoint formats.
Could you also provide a simple repro script python code? This issue is related to this line tensor.py#L785 StridedSlice.
We were encountering the same issue when we tried to convert a model for which we wrote a custom layer. We were at first a bit confused because we nowhere explicitly used a StridedSlice but figured it was somewhere in the implementation of one of the functions we used.
What fixed the issue for us, oddly enough, was to explicitly specify the newest opset. i.e.:
model = tf.keras.models.load_model(model_path)
tf2onnx.convert.from_keras(model, output_path="model.onnx")
threw the same error @rtm-1dyakonov encountered above, but
model = tf.keras.models.load_model(model_path)
tf2onnx.convert.from_keras(model, output_path="model.onnx", opset=15)
did not. I guess there may be something wrong with the default opset? Hope that helps :)
Starting from opset 10, tf2onnx changed the way to handle StridedSlice op and accepted "new_axis_mask" attribute. So your solution is expected.
Just newly installed tf2onnx and ran into this issue using default values. Should the default opset be set higher to avoid these problems? I'd say ML is a fast enough moving field currently that newer features should be preferred to compatibility for now.
Just newly installed tf2onnx and ran into this issue using default values. Should the default opset be set higher to avoid these problems? I'd say ML is a fast enough moving field currently that newer features should be preferred to compatibility for now.
Yes, there is another PR changing the default opset to 13. Please look forward to next release. Thanks!