Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] panic should be a Scalar instead! #2781

Open
NerdToMars opened this issue Feb 6, 2025 · 3 comments
Open

[WIP] panic should be a Scalar instead! #2781

NerdToMars opened this issue Feb 6, 2025 · 3 comments
Labels
bug Something isn't working onnx

Comments

@NerdToMars
Copy link

NerdToMars commented Feb 6, 2025

Describe the bug

When converting an onnx model got panic as shown in the title.

Adds some debugging logs:

DEBUG burn_import::onnx::to_burn: Node outputs first : Some(Argument { name: "gather1_out1", ty: Tensor(TensorType { elem_type: Int64, dim: 0, shape: None }), value: None, passed: false })

ERROR burn_import::logger: PANIC => panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/burn-import-0.15.0/src/burn/ty.rs:200:9:
assertion left != right failed: name: gather1_out1; shape:None; kind:Int --???: Trying to create TensorType with dim = 0 - should be a Scalar instead!

The pannic is happening when try to convert the Onnx Argument type to burn Type.

Here is the onnx op info:

Some(Argument { name: "gather1_out1", ty: Tensor(TensorType { elem_type: Int64, dim: 0, shape: None }), value: None, passed: false })

To Reproduce

Expected behavior

Screenshots

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

@laggui laggui added bug Something isn't working onnx labels Feb 6, 2025
@laggui
Copy link
Member

laggui commented Feb 6, 2025

Thanks for reporting!

Linking a related issue: #2699

Support for scalar tensors in ONNX import has been added progressively but the importer is not complete. The effort is mostly community-driven at this stage since we don't have enough bandwidth internally.

@NerdToMars
Copy link
Author

Thanks for super fast response, I'd like to help, but probably need to take some time to look into this issue cuz I just start to use burn(thx for this nice crate it's awesome).

If possible would you mind sharing your thoughts about the direction of potential solutions?

@laggui
Copy link
Member

laggui commented Feb 6, 2025

If the issue really is with the output of your gather node that is a scalar, we need to expand the GatherNode implementation to support scalar outputs.

The codegen in forward(...) only works for a tensor output.

That also means that the conversion should accept scalar or tensor types (which is probably the current point of failure given the panic message).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working onnx
Projects
None yet
Development

No branches or pull requests

2 participants