-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add sliding_window operator #9816
Conversation
1223395
to
2e2c9b1
Compare
2e2c9b1
to
49fb82c
Compare
Force-pushed to retrigger tests. Unsure why the test failed last time -- it failed on a seemingly unrelated test (an autotuner test). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you got all the things you needed for a new op. I don't know if you found it already, but I follow this guide: https://tvm.apache.org/docs/dev/how_to/relay_add_op.html.
I do think having an example is useful. |
I was getting errors - - is there documentation on how to write examples? all the other examples in this file are rather simple, but to illustrate the use I think we need to use at least a relay executor and numpy random tensors. is that possible? |
Here's an example of using an example: https://github.com/apache/tvm/blob/main/python/tvm/relay/op/random/kernel.py#L59-L67. Examples are not run, so they don't necessarily need to be valid code. |
This is a partial revert. This reverts commit c810c2d.
Oh, huh, i was getting this error:
I assumed this was because something was trying to run the Python code, which is why I removed the example. Turns out, I think it's because there was no newline after the |
Bump, ready for review by a code owner. |
I don't like the name "windows". How about |
@masahi done! |
* Add windows operator * remove TODO * Convert ICHECKs to CHECKs * Report errors using diagnostic context * Use more readable CHECKs * Remove example; move comments to test * Revert "Remove example; move comments to test" This is a partial revert. This reverts commit c810c2d. * Add newline to fix Sphinx error * windows -> sliding_window * whitespace * fmt
* Add windows operator * remove TODO * Convert ICHECKs to CHECKs * Report errors using diagnostic context * Use more readable CHECKs * Remove example; move comments to test * Revert "Remove example; move comments to test" This is a partial revert. This reverts commit c810c2d. * Add newline to fix Sphinx error * windows -> sliding_window * whitespace * fmt
Adds the windows operator, which slides a window over a tensor to produce a new tensor of all possible windows. This is an essential operation for implementing the
im2col
transformation, which transforms a conv2d into a matrix multiplication by constructing the windows over the activation tensor and storing them explicitly in memory.This is the first time I've added an operator to TVM, so please let me know if I've missed anything. I am also happy to spend more time adding more tests and documentation.