tvm icon indicating copy to clipboard operation
tvm copied to clipboard

[frontend][onnx]fix pad constant value is none

Open chengven027 opened this issue 3 years ago • 10 comments
trafficstars

hi, cc @AndrewZhaoLuo When I import my onnx model. I found my model get a error with pad. because the pad constant value is none. shown as follow: 1661258976676 It`s just a very little bug. So I fix it and no unnit test.

chengven027 avatar Aug 23 '22 12:08 chengven027

Dose this PR need to be reviewed again? @AndrewZhaoLuo @leandron

chengven027 avatar Aug 25 '22 07:08 chengven027

Dose this PR need to be reviewed again? @AndrewZhaoLuo @leandron

Yeah I'll leave it to Leandron B)

AndrewZhaoLuo avatar Aug 25 '22 16:08 AndrewZhaoLuo

I am sorry, I really can't create an unit test with empty string of constant_value. @leandron @AndrewZhaoLuo

chengven027 avatar Aug 30 '22 10:08 chengven027

I am sorry, I really can't create an unit test with empty string of constant_value. @leandron @AndrewZhaoLuo

In verify_pad_v11 I can seem to make the following:

          graph = helper.make_graph(
                [node],
                "pad_test",
                inputs=[
                    helper.make_tensor_value_info("input", TensorProto.FLOAT, list(indata.shape)),
                    helper.make_tensor_value_info("pads", TensorProto.INT64, (len(pads),)),
                    helper.make_tensor_value_info("constant_value", TensorProto.STRING, (1,)),
                ],
                initializer=[
                    helper.make_tensor("pads", TensorProto.INT64, (len(pads),), pads),
                    helper.make_tensor("constant_value", TensorProto.STRING, (1,), [b""]),
                ],
                outputs=[
                    helper.make_tensor_value_info("output", TensorProto.FLOAT, list(outdata.shape))
                ],
            )

However, my version of ONNXRT can't seem to accept the string type. What have you tried?

AndrewZhaoLuo avatar Aug 31 '22 17:08 AndrewZhaoLuo

@AndrewZhaoLuo Yes, I tried many times but I got the same error as yours. onnxruntime.capi.onnxruntime_pybind11_state.InvalidGraph: [ONNXRuntimeError] : 10 : INVALID_GRAPH : This is an invalid model. Type Error: Type 'tensor(string)' of input parameter (constant_value) of operator (Pad) in node () is invalid.

chengven027 avatar Sep 01 '22 02:09 chengven027

Can you share your model by any chance? Can you also run your model via ONNX-RT?

AndrewZhaoLuo avatar Sep 01 '22 18:09 AndrewZhaoLuo

Can you share your model by any chance? Can you also run your model via ONNX-RT?

coat_model.zip

  1. model have been uploaded.
  2. The model can pass by ONNX-RT. And the floating point comparison between tvm and onnx-RT result can also pass.

chengven027 avatar Sep 02 '22 02:09 chengven027

Sorry, I'll take a look tomorrow.

Edit: On Friday

AndrewZhaoLuo avatar Sep 06 '22 16:09 AndrewZhaoLuo

Hey, @AndrewZhaoLuo Have you seen this PR, and any update with me? thanks.

chengven027 avatar Sep 13 '22 00:09 chengven027

Oops, I am so sorry, I have been very busy lately. I will try to get to this this weekend

AndrewZhaoLuo avatar Sep 16 '22 05:09 AndrewZhaoLuo