burn icon indicating copy to clipboard operation
burn copied to clipboard

ONNX_TO_BURN: Flatten: input tensor must have at least 2 dimensions (got 0)

Open wanglong001 opened this issue 1 year ago • 2 comments

Describe the bug onnx model of yolov5 to burn error:

ERROR burn_import::logger: PANIC => panicked at /home/wzl/.cargo/git/checkouts/burn-178c6829f420dae1/f43b686/burn-import/src/onnx/op_configuration.rs:229:9:
Flatten: input tensor must have at least 2 dimensions (got 0)    
thread 'main' panicked at /home/wzl/.cargo/git/checkouts/burn-178c6829f420dae1/f43b686/burn-import/src/onnx/op_configuration.rs:229:9:
Flatten: input tensor must have at least 2 dimensions (got 0)

To Reproduce

    std::env::set_var("OUT_DIR", ".");
    let onnx_path_str = "/tmp/slient.onnx";
    // let onnx_path = std::path::PathBuf::from(onnx_path_str);
    burn_import::onnx::ModelGen::new()
        .input("/tmp/best.onnx")
        .out_dir("model/")
        .run_from_script();

Expected behavior no panic

Screenshots image

Desktop (please complete the following information):

  • OS: window11 WSL2

wanglong001 avatar Jan 11 '24 02:01 wanglong001

I will look into this soon. I have been busy with PyTorch import implementation.

antimora avatar Jan 18 '24 23:01 antimora

I encountered the same issue, and it boils down to the fact that your Split layer, or in my case LeakyReLu is not supported: https://github.com/tracel-ai/burn/blob/main/burn-import/SUPPORTED-ONNX-OPS.md

KarstenB avatar Jan 31 '24 09:01 KarstenB