tensorflow-onnx
tensorflow-onnx copied to clipboard
ERROR - tf2onnx.tfonnx: Failed to convert node 'Mean'
When I convert the delf model to onnx in tf2,
python -m tf2onnx.convert --saved-model ./ --opset 11 --output model.onnx --verbose
this error occurs:
2022-06-20 21:18:17,083 - VERBOSE - tf2onnx.tfonnx: Mapping TF node to ONNX node(s)
2022-06-20 21:18:17,157 - ERROR - tf2onnx.tfonnx: Failed to convert node 'Mean' (fct=<bound method ReduceOpBase.version_11 of <class 'tf2onnx.onnx_opset.reduction.ReduceOpBase'>>)
OP=ReduceMean\nName=Mean\nInputs:\n\tPow:0=Pow, [1, -1, -1, 2048], 1\n\tmean_reduction_indices_0:0=Placeholder, [2], 6\nOutpus:\n\tMean:0=None, 1
Traceback (most recent call last):
ValueError: get tensor value: 'mean_reduction_indices_0' must be Const
All opset versions have been tried.
My Model: https://drive.google.com/file/d/1wnq9nCyOePdY7d4q3b3NJfcP4HIIREJ5/view?usp=sharing
The error is raised from https://github.com/onnx/tensorflow-onnx/blob/76924dfd598858489009b93279b6f57e80fc841b/tf2onnx/onnx_opset/reduction.py#L31.
The second input of Mean
op should be const axes
instead of a Placeholder mean_reduction_indices_0
.
But it looks ok in frozen pb graph,
.
Need to make more investigation to check if it's something related to const folding.