ZhangGe6 / onnx-modifier

A tool to modify ONNX models in a visualization fashion, based on Netron and Flask.
MIT License
1.28k stars 157 forks source link

delete error #82

Closed Lewis-Lu closed 11 months ago

Lewis-Lu commented 11 months ago

Hi there,

It seems that the error happens in the save phase after I deleted the node. The parent modules are missed from the node I deleted.

image

I tried to delete cast node

Then the saved onnx would be image

The procedures were:

select cast, delete single node, enter, select first conv module, change the input X to the img_feat, enter.

Is there any methods for this issue? or I could do a PR for this. Best, Lewis

ZhangGe6 commented 11 months ago

@Lewis-Lu Thanks for reporting. This is a bug and has been fixed. Please update to the latest code and take a try. Feel free for more discussions if any problem still exists.

Lewis-Lu commented 11 months ago

Hi @ZhangGe6 ,

Thanks for replying. The input node preserved successfully, while the output node is lost. We may need adding output check in modify.py

Thanks, Lewis

ZhangGe6 commented 11 months ago

The lost of output node is usually caused by unperfect shape inference. Did you choose "shape inference" when clicking download or change the batch size? Can you provide the ONNX model file (if possible) to help debugging? Thanks.

Lewis-Lu commented 11 months ago

Hi @ZhangGe6,

Without shape inference, the output is right.

Thanks, Lewis