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: aten::split behavior with negative indexing #1403

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

gs-olive
Copy link
Collaborator

@gs-olive gs-olive commented Oct 13, 2022

Description

RuntimeError: [Error thrown at core/conversion/conversion.cpp:428] Expected eval_list->elements().size() == n->outputs().size() to be true but got false
Size of evaluated results: 3 and node outputs size: 2 must match.
  • Bug involves the use of a negative index (-1) when applying the aten::split operator
  • Improved axis handling in add_split to account for negative indexing
  • Improved error handling in add_split to ensure valid axes for C++ indexing
  • Added regression test to replicate error

Fixes #1410

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • [ x ] My code follows the style guidelines of this project (You can use the linters)
  • [ x ] I have performed a self-review of my own code
  • [ x ] I have commented my code, particularly in hard-to-understand areas and hacks
  • [ x ] I have made corresponding changes to the documentation
  • [ x ] I have added tests to verify my fix or my feature
  • [ x ] New and existing unit tests pass locally with my changes
  • [ x ] I have added the relevant labels to my PR in so that relevant reviewers are notified

- Identify issue arising in the deepset/roberta-base-squad2 HuggingFace
network (https://huggingface.co/deepset/roberta-base-squad2) during
conversion
- Bug involves the use of a negative index (-1) when applying the
aten::split operator
- Improved axis handling in add_split to account for negative indexing
- Improved error handling in add_split to ensure valid axes for C++
indexing
@github-actions github-actions bot added component: conversion Issues re: Conversion stage component: converters Issues re: Specific op converters component: core Issues re: The core compiler component: tests Issues re: Tests labels Oct 13, 2022
Comment on lines +283 to +284
// refer to
// https://github.com/pytorch/pytorch/blob/974ad8fa6cc63b89234beb5ebff54c2d42711932/torch/onnx/symbolic_opset9.py#L4627
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Switched original link to permalink

@gs-olive gs-olive changed the title fix: Correct aten::split behavior when negative indexing is applied fix: aten::split behavior when negative indexing is applied Oct 13, 2022
@gs-olive gs-olive changed the title fix: aten::split behavior when negative indexing is applied fix: aten::split behavior with negative indexing Oct 13, 2022
@gs-olive gs-olive marked this pull request as ready for review October 14, 2022 21:30
Copy link
Collaborator

@narendasan narendasan left a comment

Choose a reason for hiding this comment

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

LGTM!

@narendasan narendasan merged commit f6ba547 into pytorch:master Oct 18, 2022
@gs-olive gs-olive deleted the split_negative_dims_bugfix branch October 21, 2022 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed component: conversion Issues re: Conversion stage component: converters Issues re: Specific op converters component: core Issues re: The core compiler component: tests Issues re: Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 [Bug] Encountered bug when converting deepset/roberta-base-squad2 Hugging Face Network
3 participants