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

Slice Operator #153

Open
seddonm1 opened this issue Mar 26, 2023 · 2 comments
Open

Slice Operator #153

seddonm1 opened this issue Mar 26, 2023 · 2 comments

Comments

@seddonm1
Copy link

Currently the Onnx Slice operator is not implemented.

I have just started looking at the WGSL code and may be able to work this out slowly but wanted to know if there is anything that is required before being able to implement the operator?

@pixelspark
Copy link
Collaborator

Hi! The Slice operator should be fairly straightforward to implement - I suggest you to take a look at the implementation of e.g. the Gather op which is a bit more complicated (or e.g. Softmax to see how to deal with the axis logic). Basically, you would first calculate the size of the output, then write a shader that (for each element of the output, but chunked for efficiency) copies the relevant elements from the source to the output vector.

For implementing a new op, simply follow the instructions in the README.

I will be happy to assist you and review a PR. We do require contributions to be licensed "MIT OR Apache-2.0" and before merging I would also like to see a test for the op included (as well as the relevant ONNX backend op tests enabled).

Note that shape inference for Slice is already implemented here so that's one thing you don't have to worry about anymore :-)

@seddonm1
Copy link
Author

Thanks @pixelspark .

I will see what I can work out having only very limited exposure to compute shaders.

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

No branches or pull requests

2 participants