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

Add Operators: subtraction, multiplication, concat and stride slice #224

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from

Conversation

dboyliao
Copy link
Member

@dboyliao dboyliao commented Jun 6, 2021

Add operators to runtime:

  • SubOperator: elementwise subtraction
  • MulOperator: elementwise multiplication
  • ConcatOperator: concat tensors along given axis
  • StrideSliceOperator: strided tensor slicing, ex t[:, ..., :3]

@mbartling
Copy link
Member

@dboyliao Can you add some quick comments on the StridedIterator in this chat? I'm pretty sure you wrote the original stride op

@dboyliao
Copy link
Member Author

dboyliao commented Jun 7, 2021

Ok.
The basic idea of StridedIterator is simple, it will give you the linear index/offset of the source tensor given the stride slice specs.
For example, if the given slice specs are 0:3 and 1:5:2 and input tensor of shape (5, 10), all possible strided indices are:

  • (0, 1), with linear index 1
  • (0, 3), with linear index 3
    ....
  • (2, 9), with linear index 29

Then in the strided slice op, I only need to copy value from source tensor based on the linear indices.

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

Successfully merging this pull request may close these issues.

None yet

2 participants