webonnx / wonnx

A WebGPU-accelerated ONNX inference run-time written 100% in Rust, ready for native and the web
Other
1.61k stars 59 forks source link

Issues with GEMM #176

Closed satyajitghana closed 1 year ago

satyajitghana commented 1 year ago

Issues with loading a simple FC layers Model

SessionError {ptr: 1638408} "IR error: issue with data types: encountered parametrized dimensions 'Gemmoutput_dim_0'; this is not currently supported (this may be solved by running onnx-simplifier on the model first)"

Attached mnist.onnx and mnist.script.pt

mnist.zip

I've tried running onnx-simplifier on it, doesn't do anything.

pixelspark commented 1 year ago

Well, wonnx doesn't support parametrized dimensions: you need to explicitly specify shapes up front. onnx-simplifier will not do this by default, but has options to specify the missing dimension parameters, and will then fill them in for you.

pixelspark commented 1 year ago

Also (see README) the nnx prepare command supports setting parametrized dimensions:

To specify dynamic dimension parameters, add e.g. --set batch_size=1.

It may or may not work in your case because not all op types are supported currently.