Skip to content

Conversation

@eellison
Copy link
Contributor

strings allow negative indexing in python

@eellison eellison requested a review from driazati July 10, 2019 19:21
@pytorchbot pytorchbot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Jul 10, 2019
auto index = pop(stack).toInt();
auto string = pop(stack).toStringRef();
char c = string.at(index);
auto norm_index = normalizeIndex(index, string.size());
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you modify the __getitem__ overload for string instead? I think we plan to deprecate those prim operators and all using aten::__getitem__ for indexing #22276

@eellison eellison requested a review from wanchaol July 24, 2019 01:14
Copy link
Collaborator

@wanchaol wanchaol left a comment

Choose a reason for hiding this comment

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

looks good, CI is broken though

@eellison
Copy link
Contributor Author

@pytorchbot rebase this please

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@eellison is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@eellison merged this pull request in 19d3a7a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants