-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[Relax][Torch] AssertionError: Unsupported function types ['mean.default'] #18574
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
Conversation
…ult'] - Summary: Happen when convert module from exported_program have torch.mean without dim. - Resolved: Add "mean.default" into create_convert_map in class ExportedProgramImporter.
Summary of ChangesHello @locnd182644, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a specific conversion issue within the Relax frontend for PyTorch's Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly addresses an AssertionError for the unsupported function type mean.default when importing a PyTorch exported_program. The issue occurs when torch.mean is used without a dim argument. The fix involves mapping mean.default to the existing _mean handler, which is appropriate as it already handles cases where the dimension is None. The addition of a new test case, MeanWithoutDim, in test_frontend_from_exported_program.py is excellent, as it ensures this scenario is covered and prevents future regressions. The changes are sound and well-tested. I have a few minor suggestions to improve code style by removing trailing whitespace.
| "any.dim": self._any, | ||
| "any.dims": self._any, | ||
| "mean.dim": self._mean, | ||
| "mean.default": self._mean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| class MeanKeepDim(Module): | ||
| def forward(self, input: torch.Tensor): | ||
| return input.mean(-1, keepdim=True) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| gv: R.Tuple(R.Tensor((256, 1), dtype="float32")) = (lv,) | ||
| R.output(gv) | ||
| return gv | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tlopex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks!
|
@tvm-bot rerun |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/20419842803 Detailswith response |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/20419842803 Detailswith response |
|
Hi @locnd182644 Sorry, the CI seems stuck and GitHub “Re-run all jobs” fails for me. Could you please push an empty commit to retrigger CI, or rerun the checks from your side? |
|
@tlopex Thank you. I will rerun the check now. |
…into relax/torch/mean
Summary
Happen error when create module from exported_program have torch.mean without dim.
Reproduce
Resolve: