onnx / onnx-tensorflow

Tensorflow Backend for ONNX
Other
1.27k stars 296 forks source link

BackendIsNotSupposedToImplementIt: Unique is not implemented. #955

Open chenluuyou opened 3 years ago

chenluuyou commented 3 years ago

Describe the bug

When I want to convert the onnx model to the tf model, a unique operator does not support it. Is there anything I can replace this operator?

To Reproduce

Please give us instructions to reproduce your problem.

A self-contained piece of code that can demonstrate the problem is required.

Please do not expect us to have PyTorch, Caffe2 installed.

If a model exported from PyTorch and Caffe2 is having trouble in ONNX-TF, use the next section to attach the model.

ONNX model file

模型文件

Python, ONNX, ONNX-TF, Tensorflow version

This section can be obtained by running get_version.py from util folder.

Additional context

Add any other context about the problem here.

chinhuang007 commented 3 years ago

Thanks for bringing this up to our attention. Tensorflow has only limited support for unique, input has to be 1-d and no sort option. The conversion from ONNX definition therefore will need to go through a few computational steps. Unfortunately we are short in resources. So contributions are very welcome!

xiaotiancd commented 3 years ago

@chinhuang007 shall we follow the rules Tensorflow has to implement? I saw Onnx has different definition about this operator. Thanks.

chinhuang007 commented 3 years ago

@xiaotiancd sorry for the late response... In general, I think we should follow what ONNX has defined and attempt to implement the logic/rules using Tensorflow ops. If a complete support in Tensorflow is not possible, we could declare a partial support for this particular operator, for instance, no sorting or more than 1-d input.

ZemingZhao commented 3 years ago

@chenluuyou may I know how to get your input dataset of the onnx model? It's needed for UT. the generated 1x3x512x512 dataset does not work: onnxruntime.capi.onnxruntime_pybind11_state.RuntimeException: [ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Non-zero status code returned while running Reshape node. Name:'Reshape_816' Status Message: /Users/runner/work/1/s/onnxruntime/core/providers/cpu/tensor/reshape_helper.h:42 onnxruntime::ReshapeHelper::ReshapeHelper(const onnxruntime::TensorShape &, std::vector &, bool) gsl::narrow_cast(input_shape.Size()) == size was false. The input tensor cannot be reshaped to the requested shape. Input shape:{2709}, requested shape:{266}