Skip to content

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

Open
dboyliao wants to merge 28 commits intodevelopfrom
dboy_work
Open

Add Operators: subtraction, multiplication, concat and stride slice#224
dboyliao wants to merge 28 commits intodevelopfrom
dboy_work

Conversation

@dboyliao
Copy link
Copy Markdown
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]

@dboyliao dboyliao requested review from mbartling and neil-tan June 6, 2021 04:45
@mbartling
Copy link
Copy Markdown
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
Copy Markdown
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.

2 participants