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

Fix empty tensor when select -1 #1787

Merged
merged 1 commit into from
Jan 17, 2023
Merged

Fix empty tensor when select -1 #1787

merged 1 commit into from
Jan 17, 2023

Conversation

li-plus
Copy link
Collaborator

@li-plus li-plus commented Jan 10, 2023

This PR fixed issue #1764 by first converting the start index to non-negative value before calculating the end index. The conversion is: start += int(start < 0) * dimSize. This can avoid end being 0 when start is -1.

I also added a test case SelectIntNegativeDimAndIndexStaticModule_basic that did not pass in LINALG backend without this PR to prove the correctness of my implementation.

@li-plus
Copy link
Collaborator Author

li-plus commented Jan 12, 2023

@ramiro050 Would you review this PR? Thanks.

@ramiro050 ramiro050 self-requested a review January 12, 2023 19:24
Copy link
Collaborator

@ramiro050 ramiro050 left a comment

Choose a reason for hiding this comment

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

Thanks for this fix! Other than adding the e2e tests IntBoolOp, LGTM

lib/Dialect/Torch/IR/TorchOps.cpp Show resolved Hide resolved
@li-plus
Copy link
Collaborator Author

li-plus commented Jan 13, 2023

If everything is ok, would you please merge it for me? And I'll close the related issue.

@ZihengJiang ZihengJiang merged commit e269843 into llvm:main Jan 17, 2023
@ZihengJiang
Copy link
Collaborator

Merged. Thanks @li-plus and @ramiro050

@li-plus li-plus deleted the fix-select branch January 19, 2023 02:46
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.

3 participants