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

Type 'tensor(float16)' of input parameter of operator (Resize) in node () is invalid #361

Open
maaft opened this issue Dec 19, 2019 · 10 comments

Comments

@maaft
Copy link

maaft commented Dec 19, 2019

AFAIK Resize doesn't support float16 and should therefore be ignored during conversion from float to float16.

@mnboos
Copy link

mnboos commented Mar 24, 2020

We have the same problem. Will this problem be approached in the near future?

@xadupre
Copy link
Collaborator

xadupre commented Apr 15, 2020

It would save me some time if you would add an example but float16 should be supported with maybe a couple if fixes.

@19ethan
Copy link

19ethan commented Sep 27, 2021

@maaft hello i have the same question ,after i Convert the model from float32 to float 16, i checked this operator Resize, It was originally a torch.nn.functional.interpolate function

@xadupre
Copy link
Collaborator

xadupre commented Sep 27, 2021

The latest versions of ONNX do support Resize for float16. Which version of packages onnx, onnxruntime, torch do you use?

@19ethan
Copy link

19ethan commented Sep 27, 2021

onnxruntime=1.8.1, torch==1.9.0,python=3.7

@xadupre
Copy link
Collaborator

xadupre commented Sep 27, 2021

I'll need the version of onnx packages and the error message you get.

@19ethan
Copy link

19ethan commented Sep 27, 2021

onnx=1.10.1 ,onnxmltools-1.9.1
onnxruntime.capi.onnxruntime_pybind11_state.InvalidGraph: [ONNXRuntimeError] : 10 : INVALID_GRAPH : Load model from C:\Users\DBNet.pytorch-master\DBNet.pytorch-master\tools\testft16.onnx failed:This is an invalid model. Type Error: Type 'tensor(float16)' of input parameter (303) of operator (Resize) in node (Resize_74) is invalid.

@xadupre
Copy link
Collaborator

xadupre commented Sep 27, 2021

onnxruntime does not implement the full ONNX specifications. This page CPU execution provider lists all available types and operator. Even if Resize has an implementation for float16, I guess others operators will fail. Is there any way you can switch to float32? However, this is an issue for onnxruntime or pytorch.

@19ethan
Copy link

19ethan commented Sep 27, 2021

The pytorch model can be converted to onnxfloat32, it works,i can use it to infer . The float32 can be converted to float16 using onnxmltools,it works , but the onnxfloat16 It reports that error.

@xadupre
Copy link
Collaborator

xadupre commented Sep 27, 2021

This function is implemented in onnxconverter_common. It assumes all operators in graph have a runtime which supports float16. That's not the case for onnxruntime. The model may be valid but cannot be run unless onnxruntime supports float16 for all operators in your graph. You need to use a different runtime or raise an issue on onnxruntime repository with the list of operators you need to support float16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants