You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] parse the output number of MaxPool incorrectly #14614
Traceback (most recent call last):
...
irmod, params = relay.frontend.from_onnx(predict_model, shape_dict, freeze_params=True)
File "/workplace/software/tvm/tvm/python/tvm/relay/frontend/onnx.py", line 7346, in from_onnx
mod, params = g.from_onnx(graph, opset)
File "/workplace/software/tvm/tvm/python/tvm/relay/frontend/onnx.py", line 6963, in from_onnx
self._construct_nodes(graph)
File "/workplace/software/tvm/tvm/python/tvm/relay/frontend/onnx.py", line 7120, in _construct_nodes
len(node_output), outputs_num, op_name
AssertionError: Number of output mismatch 2 vs 1 in MaxPool.
Hello @jikechao! It is simply not supported on ONNX front-end of TVM. The implementation of MaxPool (AveragePool as well) was done for onnx opset = 1, but optional second output (Indices) appeared only since opset = 8. It needs to extend implementation for the op, if you do it, it will be good
@vvchernov Thanks for your comments! Indeed, this crash was caused by Indices appearing since opset=8. However, this feature existing about 5 years. Thus, Supporting Indices to avoid this crash may not be trivial. Thus, I'll try to fix it.
Hello @jikechao! Some nits may be help you to fix. There can be problems with optional output and indices calculation, in both cases you can see how it was implemented for scatter_elements (ScatterElements class)
This also affects the Relax ONNX frontend in TVM 0.28.dev0. A one-output MaxPool executes correctly, but requesting the legal optional indices output fails with Missing outputs during conversion. Expected 2 but Got 1 in MaxPool. I am adding a self-contained Relax reproducer here rather than opening a duplicate report.
Tested on Linux x86_64, LLVM CPU, TVM 0.28.dev0 (installed binary revision unknown); no current-main rebuild.
Activity
jikechao commentedon Apr 14, 2023
@masahi @jwfromm @vvchernov Could you help me check this crash? Thanks a lot!
vvchernov commentedon Apr 14, 2023
Hello @jikechao! It is simply not supported on ONNX front-end of TVM. The implementation of MaxPool (AveragePool as well) was done for onnx opset = 1, but optional second output (Indices) appeared only since opset = 8. It needs to extend implementation for the op, if you do it, it will be good
jikechao commentedon Apr 15, 2023
@vvchernov Thanks for your comments! Indeed, this crash was caused by Indices appearing since opset=8. However, this feature existing about 5 years. Thus, Supporting Indices to avoid this crash may not be trivial. Thus, I'll try to fix it.
vvchernov commentedon Apr 18, 2023
Hello @jikechao! Some nits may be help you to fix. There can be problems with optional output and indices calculation, in both cases you can see how it was implemented for scatter_elements (ScatterElements class)
sunni13830 commentedon Nov 7, 2026
This also affects the Relax ONNX frontend in TVM 0.28.dev0. A one-output MaxPool executes correctly, but requesting the legal optional indices output fails with
Missing outputs during conversion. Expected 2 but Got 1 in MaxPool.I am adding a self-contained Relax reproducer here rather than opening a duplicate report.Tested on Linux x86_64, LLVM CPU, TVM 0.28.dev0 (installed binary revision unknown); no current-main rebuild.