burn icon indicating copy to clipboard operation
burn copied to clipboard

yolov10 ReduceMax keepdims == 0

Open sihaiwuhu opened this issue 9 months ago • 1 comments

Hi, there is a panic like this when building from yolov10.onnx model. How should I solve this error?

ERROR burn_import::logger: PANIC => panicked at /home/ubuntu/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/burn-import-0.16.0/src/onnx/op_configuration.rs:1467:9: ReduceMax: the reduce operation must preserve the reduced dimension

--- stderr thread 'main' panicked at /home/ubuntu/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/burn-import-0.16.0/src/onnx/op_configuration.rs:1467:9: ReduceMax: the reduce operation must preserve the reduced dimension note: run with RUST_BACKTRACE=1 environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... ubuntu@PC-PW09NVP9:/mnt/d/workspace/rust_ws/burn_demo1$

sihaiwuhu avatar Feb 15 '25 09:02 sihaiwuhu

That's because keepdims is set to false, and that's not currently supported when converting the model to Burn code.

https://github.com/tracel-ai/burn/blob/dd628ec91c8dafa7f5767d85f822d46dec8f4707/crates/burn-import/src/onnx/op_configuration.rs#L1465-L1468

In burn, tensor.max_dim(dim) returns a tensor of the same rank (with a dim of size 1 where it was reduced). The support could be expanded in the codegen to chain a max operation with .squeeze(dim) when keepdims is false.

laggui avatar Feb 17 '25 15:02 laggui

keepdims == 0 has been fixed by https://github.com/tracel-ai/burn/pull/3497

antimora avatar Aug 18 '25 23:08 antimora