KeyError: 'ConstantOfShape'
See original GitHub issueHi, I am working on the conversion of onnx to keras, until I got this error message:
...
DEBUG:onnx2keras:Check input 0 (name 73).
DEBUG:onnx2keras:... found all, continue
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-9-c9733b56662e> in <module>()
2
3 # Call the converter (input - is the main model input name, can be different for your model)
----> 4 k_model = onnx_to_keras(onnx_model, input_name_list)
/usr/local/lib/python3.6/dist-packages/onnx2keras/converter.py in onnx_to_keras(onnx_model, input_names, input_shapes, name_policy, verbose, change_ordering)
170 logger.debug('... found all, continue')
171
--> 172 AVAILABLE_CONVERTERS[node_type](
173 node,
174 node_params,
KeyError: 'ConstantOfShape'
There is no any other indications, is there any ideas about how to solve this problem?
onnx version 1.6 onnx2keras version 0.0.18
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Trouble Converting LSTM Pytorch Model to ONNX
I am trying to export my LSTM Anomally-Detection Pytorch model to ONNX, but I'm experiencing errors. Please take a look at my code...
Read more >Model Optimizer issue with a custom ONNX model
Solved: Hi, I am having issue while running Model Optimizer on a custom ONNX model file exported from Matlab. This model takes a...
Read more >PyTorch: torch/onnx/symbolic_opset11.py - Fossies
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting...
Read more >crnn模型onnx转rknn报错- Toybrick - Powered by Discuz!
Load model failed! 查询文档得知KeyError似乎是因为有op不支持,但是后面提示是空的,不知道是哪个op报错了, ...
Read more >Yolov5 evaluate 發生問題— Kneron Developer Forums
[piano][warning][helper_node.cc:18][EmptyNode] Warning: creating an EmptyNode instance for op_type: ConstantOfShape ... KeyError: 'images'.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I fixed it with creating converter for constanOfShape ConstantOfShape creates a constant with value stored in node of shape passed as input so np.full is basically what it does ref https://github.com/onnx/onnx/blob/master/docs/Operators.md#Constant https://github.com/onnx/onnx/blob/master/docs/Operators.md#ConstantOfShape
Got other errors too, so not sure if it is working properly
You can also try exporting to onnx opset_version=9. In my case it avoided creation of constantOfShape