-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[FRONTEND][ONNX] 'Shape' operator not implemented #1297
Comments
I have an active PR in tensor flow for Shape. You could take ref and implement for ONNX. |
could you please share the link of your PR . |
I have converted only a fragment of alexnet tf model into onnx, containing the 'Shape' operator for easy debugging.
In my graph Attributes for 'Shape' is empty{} . I see no attr['_input_shapes'] for op_type 'Shape'.
So what does " %Shape:0 = Shape(%Conv2D__3:0)" mean ? how to feed Conv2D__3:0 as input for 'Shape'. |
You can't copy the function as it is, it's only a reference. Can you share the ONNX graph ? |
Hi please find the attached onnx file |
I checked the graph and it's a bit different from tensorflow. We may need Shape as an operator from compiler / topi in this case. @tqchen |
I further checked and here is my observation. Tensorflow uses Shape operator to derive shape as a Tensor. TVM Reshape operator doesn't support Tensor argument for shape (it's a tuple instead). At this point I advice to use tensorflow frontend directly which handle these issues with _output_shapes until we have "Shape" and extended "Reshape" operator support in TVM. |
@srkreddy1238 Thanks for the explanation . So maybe i have to wait for the shape operator to be available in TVM to try out this ONNX model ! |
I will PR the shape and reshape_like soon. I could enhance the tensor flow too with these. |
@srkreddy1238 |
@zwhdang For example Reshape receiving the "to shape" as an input Tensor cannot pass through compilation process in current framework. I have seen Shape operator in Tensorflow and may be inherited into ONNX to keep the compatibility. But with TVM it's a challenge. I was able to workaround in tensorflow frontend as I have the output_shapes and input_shapes in the graph definition. |
@srkreddy1238 |
Seems most of the shape requirement was to achieve reshape_like, which we cold have a specialization path |
I am thinking on below two approaches.
Or
|
Ref. #1333 much simpler and better approach. |
@srkreddy1238
|
This model need Slice , Squeeze and Unsqueeze (expand_dims) to get through. I am working for tensorflow and onnx to start with. I will try to push these operators first to unblock you. |
#1339 for Squeeze and Unsqueeze. |
I have an Alexnet-ONNX model converted from Tensorflow which contains 'Shape' operator.
Unfortunately while loading in nnvm , it fails with
NotImplementedError: Operator Shape not implemented.
and i couldn't find the same in
nnvm.symbol
(nnvm tensor operator api).Basically 'Shape' operator (as specified in onnx operator List ) is to infer the shape of input tensor as 1D int64 output tensor .
Is there any alternative way to output the shape in 1D int64 tensor in onnx frontend ?
The text was updated successfully, but these errors were encountered: