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

How to add and initialize a constant? #103

Closed TiRune closed 1 month ago

TiRune commented 5 months ago

I'm looking to add a constant 1 input to this LSTM node for 'sequence_lens'. I tried adding something like int32[1] there, or just [1], but it looks for an output node with that name. I also tried adding a Constant node - but I have no idea how to add something to 'value' or 'output' such that it sets the values to a constant 1 that is int32 in value. I tried everything here I could think of, but nothing along the lines of int32[1] etc. works.

Trying to export anything with a const node gives me a : RuntimeError: type tensor is not considered in current version. Currently supported types are:

And the value indicates the value is still 'tensor'.

What is the recommended way to add a constant into the graph?

Screenshot 2024-04-08 at 8 44 00 PM Screenshot 2024-04-08 at 8 43 39 PM