Skip to content

Support step attribute in slice from Onnx #5454

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

Closed
wants to merge 4 commits into from

Conversation

Lewuathe
Copy link
Contributor

Summary:

Support step attribute in slice node when loading ONNX format. Although it succeeds to load ONNX format having slice node with step attribute, it does not support non-1 step values. Since it should be rare to use non-1 step values for major machine learning models, we may want to prioritize loading major models such as YOLO, LSTM.

See: #3987

Test Plan:
Added two test cases passing slice node with the default steps (all having 1s) and slice node with non-1 step attributes.

@facebook-github-bot
Copy link

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

@facebook-github-bot
Copy link

@jfix71 merged this pull request in f4ec25e.

@Lewuathe Lewuathe deleted the support-step branch April 8, 2021 00:59
@posEdgeOfLife
Copy link

is there plan to support backward slice which means step = -1? As browsing the code, it feels that step can be supported by adding an additional step attribute to the node, update the extractTensor kernel in the backend.

@Lewuathe
Copy link
Contributor Author

Lewuathe commented May 6, 2021

IIUC, SliceNode is converted into ExtractTensor instruction in IR which only gets the offset parameter. We need to make ExtractTensor support additional parameters (e.g. step) so that the backend properly generates the corresponding code.

Am I correct?

@posEdgeOfLife
Copy link

IIUC, SliceNode is converted into ExtractTensor instruction in IR which only gets the offset parameter. We need to make ExtractTensor support additional parameters (e.g. step) so that the backend properly generates the corresponding code.

Am I correct?

Yes.Actually some IR optimization are depending on step=1, so I am not sure if this is wanted.

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

Successfully merging this pull request may close these issues.

4 participants