KEMBAR78
[jit] Add string index/slice operations by driazati · Pull Request #18247 · pytorch/pytorch · GitHub
Skip to content

Conversation

@driazati
Copy link
Contributor

Adds support for string indexing ("a"[0]) and slicing ("abc"[1:3])
to script.

Adds support for string indexing (`"a"[0]`) and slicing (`"abc"[1:3]`)
to script.
@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Mar 20, 2019
@driazati driazati requested review from eellison and suo March 20, 2019 21:41
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.

@driazati has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@driazati driazati requested a review from suo April 1, 2019 06:38
Copy link
Member

@suo suo left a comment

Choose a reason for hiding this comment

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

lgtm

}

std::string result;
result.insert(result.begin(), string.begin() + start, string.begin() + end);
Copy link
Member

Choose a reason for hiding this comment

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

you don't need an extra insert(), just use the constructor e.g. std::string result(string, start, end-start)

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.

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

{"max", std::make_shared<BuiltinFunction>(prim::max, at::nullopt)},
{"list", std::make_shared<BuiltinFunction>(aten::list, at::nullopt)},
{"ord", std::make_shared<BuiltinFunction>(aten::ord, at::nullopt)},
{"rangelist", std::make_shared<BuiltinFunction>(prim::rangelist, at::nullopt)},
Copy link
Member

Choose a reason for hiding this comment

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

Nit: is this line a duplicate of the line below?

zdevito pushed a commit to zdevito/ATen that referenced this pull request Apr 1, 2019
Summary:
Adds support for string indexing (`"a"[0]`) and slicing (`"abc"[1:3]`)
to script.
Pull Request resolved: pytorch/pytorch#18247

Differential Revision: D14574486

Pulled By: driazati

fbshipit-source-id: 4b42aa0881e5398ea7f112be46c0335e6e19dced
@facebook-github-bot
Copy link
Contributor

@driazati merged this pull request in be01c90.

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants