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

Resize use Sizes but Scales is single #2451

Closed
leroyzhao opened this issue Nov 12, 2019 · 7 comments
Closed

Resize use Sizes but Scales is single #2451

leroyzhao opened this issue Nov 12, 2019 · 7 comments
Assignees
Labels
operator Issues related to ONNX operators

Comments

@leroyzhao
Copy link

In the documentation, it is stated that sizes can be used as long as the name of scales is set to empty string.
image
However, after setting the name of scales to an empty string, the graph fails to load.
The error states that input 2 is marked single but has an empty string in the graph.

@erickque
Copy link

scales should probably be set as an optional input. In the schema definition, scales is defined as a Single input (default FormalParameterOption): https://github.com/onnx/onnx/blob/master/onnx/defs/tensor/defs.cc#L1741.

This contradicts the statement OP highlighted in Operators.md, as the following section of code in the schema verification requires the input to be not Single if the name is empty: https://github.com/onnx/onnx/blob/master/onnx/defs/schema.cc#L226

@askhade
Copy link
Contributor

askhade commented Nov 13, 2019

That's right... Scales description describes it as optional input BUT it is not defined as one... Therefore right now the only way is to pass an empty tensor. Same goes with roi. Please check the tests for examples

This op needs to be updated to make scales and roi as optional inputs.

@lucasjinreal
Copy link

@askhade scales input if it's initializer type, it will not be able convert to tensorrt.

[8] Assertion failed: convert_onnx_weights(initializer, &weights)

@daquexian
Copy link
Member

daquexian commented Jan 28, 2020

That's right... Scales description describes it as optional input BUT it is not defined as one... Therefore right now the only way is to pass an empty tensor. Same goes with roi. Please check the tests for examples

This op needs to be updated to make scales and roi as optional inputs.

If I remember correctly, I made it non-optional intentionally because I didn't find a way to get whether an optional input is specified, instead, I could only check the input_size, so the "scales" must be specified even if it is not used.

Please correct me if I'm wrong.

@HarryVancao
Copy link

Can we revisit updating this operator? Could we merge the sizes and scale inputs into one input and have an attribute tell the operator how to interpret the input? Then, the ROI input could be made optional.

I feel that just by passing empty to these inputs is wasteful and makes the implementation for other backends of ONNX much harder. As a side note, the spec should not tell the user to pass an empty string when the inputs is required to be float type as @leroyzhao pointed out.

@shi-yan
Copy link

shi-yan commented May 22, 2021

is there a solution for this, I must set ROI it seems. the doc is a lie.

I can't get this to work.

if I don't set roi or scale, onnx will complain.

and if I do set them I got

onnxruntime.capi.onnxruntime_pybind11_state.RuntimeException: [ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Non-zero status code returned while running Resize node. Name:'resize_224' Status Message: /onnxruntime_src/onnxruntime/core/providers/cuda/tensor/upsample.cc:162 onnxruntime::common::Status onnxruntime::cuda::Upsample<T>::ComputeInternal(onnxruntime::OpKernelContext*) const [with T = float] sizes == nullptr was false. Only one of scales or sizes must be provided as input.

@askhade
Copy link
Contributor

askhade commented Jun 21, 2021

Closing this in favor of #3500

@askhade askhade closed this as completed Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
operator Issues related to ONNX operators
Projects
None yet
Development

No branches or pull requests

7 participants