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

[Frontend][PaddlePaddle] Add topk op and Fix bug, when the output is a dimension, it … #13701

Merged
merged 11 commits into from
Jan 21, 2023

Conversation

woobinw
Copy link
Contributor

@woobinw woobinw commented Jan 5, 2023

There are some operation in PaddlePaddle that output a tensor which shape is [1], meanwhile, the slice op have decrease_axis attr, but it should not be squeezed.

@heliqi
@jiangjiajun
cc @junrushao

@tvm-bot
Copy link
Collaborator

tvm-bot commented Jan 5, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

  • No users to tag found in teams: frontend, paddlepaddle See #10317 for details

Generated by tvm-bot

@github-actions github-actions bot requested a review from junrushao January 5, 2023 03:24
Copy link
Contributor

@heliqi heliqi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

return paddle.topk(inputs, k=1)

input_data = paddle.to_tensor([1, 4, 5, 7])
verify_model(topk1, input_data=input_data)
Copy link
Contributor

@heliqi heliqi Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a few different cases, example:

  1. k is a tensor and not just a int
  2. set largest/axis/sort attribute
  3. The output is only the values or the indices.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to paddle.topk api, there seems is no a argument to control the output that only have the values or indices

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the paddle.topk api will definitely have two outputs.

@woobinw woobinw changed the title [Frontend][PaddlePaddle] Fix bug, when the output is a dimension, it … [Frontend][PaddlePaddle] Add topk op and Fix bug, when the output is a dimension, it … Jan 5, 2023
Copy link
Contributor

@jiangjiajun jiangjiajun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@junrushao
Copy link
Member

Would you like to fix the CI so we could get it in?

@woobinw woobinw closed this Jan 6, 2023
@woobinw
Copy link
Contributor Author

woobinw commented Jan 6, 2023

Would you like to fix the CI so we could get it in?
E File "/workspace/tests/python/frontend/paddlepaddle/test_forward.py", line 1356, in slice5 (* user code *) [2023-01-05T11:12:37.644Z] E b, c, h, w = paddle.shape(inputs) # add decrease_axis
I think this error may be related to the version of the paddlepaddle

@woobinw woobinw reopened this Jan 6, 2023
@heliqi
Copy link
Contributor

heliqi commented Jan 6, 2023

Would you like to fix the CI so we could get it in?
E File "/workspace/tests/python/frontend/paddlepaddle/test_forward.py", line 1356, in slice5 (* user code *) [2023-01-05T11:12:37.644Z] E b, c, h, w = paddle.shape(inputs) # add decrease_axis
I think this error may be related to the version of the paddlepaddle
@woobinw
The paddlepaddle version we matched before was 2.1.3.
If you want to upgrade and match the latest paddlepaddle version 2.4, you can pull request and modify the Paddle version in the code and the code.

@woobinw
Copy link
Contributor Author

woobinw commented Jan 9, 2023

Would you like to fix the CI so we could get it in?
E File "/workspace/tests/python/frontend/paddlepaddle/test_forward.py", line 1356, in slice5 (* user code *) [2023-01-05T11:12:37.644Z] E b, c, h, w = paddle.shape(inputs) # add decrease_axis
I think this error may be related to the version of the paddlepaddle
@woobinw
The paddlepaddle version we matched before was 2.1.3.
If you want to upgrade and match the latest paddlepaddle version 2.4, you can pull request and modify the Paddle version in the code and the code.

@heliqi I modified the Paddles version configuration of the above two location. but the following prompt information of code is mismatch 2.4.1 version of Paddle. Can you take a look at this question for verify_model(topk2, input_data=input_data) ?

[2023-01-09T07:38:22.462Z] tests/python/frontend/paddlepaddle/test_forward.py:81: in verify_model [2023-01-09T07:38:22.462Z] baseline_outputs = baseline_model(*[input[:] for input in input_data]) [2023-01-09T07:38:22.462Z] /venv/apache-tvm-py3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py:902: in __call__ [2023-01-09T07:38:22.462Z] outputs = self.forward(*inputs, **kwargs) [2023-01-09T07:38:22.462Z] /venv/apache-tvm-py3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/io.py:1191: in __i_m_p_l__ [2023-01-09T07:38:22.462Z] return _run_dygraph(self, input, program_holder) [2023-01-09T07:38:22.462Z] /venv/apache-tvm-py3.7/lib/python3.7/site-packages/paddle/fluid/dygraph/io.py:754: in _run_dygraph

@woobinw
Copy link
Contributor Author

woobinw commented Jan 16, 2023

@junrushao
The ethosu test seems to have nothing to do with PaddlePaddle frontend.

@junrushao
Copy link
Member

junrushao commented Jan 16, 2023

Thank you for pinging me @woobinw! Indeed the failure is not relevant to the change you brought in, and I'm not sure if it's flaky or consistently reproducible error. Retriggered the test just now, and let's see if it could work this time

@junrushao
Copy link
Member

@tvm-bot rerun

@junrushao
Copy link
Member

Could you rebase to latest HEAD? I’m sure it’s going to pass this time

@woobinw
Copy link
Contributor Author

woobinw commented Jan 19, 2023

Could you rebase to latest HEAD? I’m sure it’s going to pass this time

Yes, It has been rebased to latest HEAD.

@junrushao
Copy link
Member

seems like there is some issues in rebasing and now the PR has inflated to 25k lines

@junrushao junrushao merged commit d907de3 into apache:main Jan 21, 2023
@junrushao
Copy link
Member

Thanks for the contribution! It’s merged!

fzi-peccia pushed a commit to fzi-peccia/tvm that referenced this pull request Mar 27, 2023
…a dimension, it … (apache#13701)

There are some operation in PaddlePaddle that output a tensor which shape is [1], meanwhile, the slice op have decrease_axis attr, but it should not be squeezed.
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

Successfully merging this pull request may close these issues.

5 participants