[Relax][Torch] Fixed issues related to sum op when without dim and keep dim#18583
Merged
tlopex merged 5 commits intoapache:mainfrom Dec 13, 2025
Merged
[Relax][Torch] Fixed issues related to sum op when without dim and keep dim#18583tlopex merged 5 commits intoapache:mainfrom
tlopex merged 5 commits intoapache:mainfrom
Conversation
- WithoutDim: args[1] = [] and still pass into relax.op.sum -> result incorrect - KeepDim: Before keepdim value get only from node.kwargs and no pass into relax.op.sum. Now keepdim get more from args[2] and pass into.
Contributor
Author
|
@tvm-bot rerun |
Contributor
|
CI is failing due to the PR body contains |
Contributor
Author
|
@mshr-h Thank you. I will modify and rerun it now. |
Contributor
Author
|
@tvm-bot rerun |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue 1: Without Dim
Summary:
In _sum function (BaseFXGraphImporter), after retrieve_args, args[1] = [] and still pass into relax.op.sum so the result is incorrect.
Steps to Reproduce
Input: tensor([[1., 1., 1.], [1., 1., 1.]])
Torch output: tensor(6.)
Torch output shape: torch.Size([])
TVM output: [[1. 1. 1.] [1. 1. 1.]]
TVM output shape: (2, 3)
Expected
Issue 2: Keep Dim
Summary:
In _sum function (BaseFXGraphImporter), previously keepdim value get only from node.kwargs and no pass into relax.op.sum. Now keepdim get more from args[2] and pass into.
Steps to Reproduce
Input: tensor([[1., 1., 1.], [1., 1., 1.]])
Torch output: tensor([[3.], [3.]])
Torch output shape: torch.Size([2, 1])
TVM VM output: [3. 3.]
TVM VM output shape: (2,)
Expected