-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Support for empty tensors #201
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Context
I'm trying to load a feature pyramid network on top of a resnet model into onnx-go. The FPN uses an onnx Resize operator because it needs to upsample the feature maps. The Resize operator has an input (
roi
) that are optional.I'm using torch. When exporting a torch Resize operator to onnx the
roi
parameter is not used (only used fortf_crop_and_resize
coordinate transformation mode). But the torch onnx export uses a constant value of an empty tensor. It has [0] as dims and no float_data or raw_data. Since this parameter isn't used at all the value should not matter.The bug
When loading an onnx model in onnx-go it crashes because "No data found".
To generate the onnx I'm using this.
Output
To load it I'm using
Output:
Why this happens
The
onnx::Resize
operator takes%9
and%10
as an input. These are of typeFloat(0)
and dont have any data. These tensors cannot be read properly by onnx-go.The error happens here: https:/owulveryck/onnx-go/blob/master/internal/onnx/ir/tensor.go#L113
Solution
I think this can be solved by adding a check for dimensionality of the tensor to
generateConsOptsFromFloat64Tensor
and alike. If it is zero then an empty gorgonia tensor should be created.I do have some time to work on this (work project) if this solution is acceptable.
The text was updated successfully, but these errors were encountered: