Skip to content

Sequence related ops#2249

Merged
wschin merged 6 commits intoonnx:masterfrom
BowenBao:bowbao/seq_related_ops
Sep 14, 2019
Merged

Sequence related ops#2249
wschin merged 6 commits intoonnx:masterfrom
BowenBao:bowbao/seq_related_ops

Conversation

@BowenBao
Copy link
Copy Markdown
Contributor

@BowenBao BowenBao commented Aug 22, 2019

Following #2244. This PR adds the first few ops that supports basic sequence functionality in ONNX.

  • Complete sequence ops spec.
  • Update related ops with variadic inputs/outputs (concat, split, etc) spec.
  • Update shape inference for sequences.
  • Update onnx.helper for sequences.
  • Add test cases for new ops.

@BowenBao BowenBao requested review from a team as code owners August 22, 2019 00:24
Comment thread onnx/defs/sequence/defs.cc Outdated
Comment thread onnx/defs/sequence/defs.cc
Comment thread onnx/defs/sequence/defs.cc Outdated
@gramalingam
Copy link
Copy Markdown
Contributor

Re. updating ops like concat/split: I feel it may be better to introduce new ops (e.g., ConcatSequence) allowing both the older form and newer form. Once implementations stabilize (e.g, if it becomes clear that there is no cost/overhead between the two versions), if necessary, we can deprecate the older form.

@ebarsoum ebarsoum added the topic: operator Issues related to ONNX operators label Aug 23, 2019
@spandantiwari
Copy link
Copy Markdown
Contributor

Re. updating ops like concat/split: I feel it may be better to introduce new ops (e.g., ConcatSequence) allowing both the older form and newer form. Once implementations stabilize (e.g, if it becomes clear that there is no cost/overhead between the two versions), if necessary, we can deprecate the older form.

I agree with this.

@spandantiwari
Copy link
Copy Markdown
Contributor

This is relevant to this PR and maybe even #2244 which brings in Sequence and Map types in ONNX. Do we want to rethink the name Sequence for the datatype and these new ops, given that it is also commonly used for data "sequences" for RNN models? This may cause confusion, if only initially, between the two because the Sequence type used here is not really what will be used for sequences for RNN models.

@BowenBao
Copy link
Copy Markdown
Contributor Author

This is relevant to this PR and maybe even #2244 which brings in Sequence and Map types in ONNX. Do we want to rethink the name Sequence for the datatype and these new ops, given that it is also commonly used for data "sequences" for RNN models? This may cause confusion, if only initially, between the two because the Sequence type used here is not really what will be used for sequences for RNN models.

I agree. There is also an existing operator named ReverseSequence, which is unrelated to the Sequence type.

Copy link
Copy Markdown
Contributor

@shinh shinh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this work! I'm really happy to see this PR since our framework (chainer-compiler) already has similar ops for sequence. Let me ask two questions.

Comment thread docs/Operators.md
Comment thread docs/Operators.md
Copy link
Copy Markdown
Contributor

@shinh shinh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me leave one more comment

Comment thread docs/Changelog.md
@BowenBao
Copy link
Copy Markdown
Contributor Author

Let me leave one more comment

Thanks for your comments! These are very helpful suggestions.

Comment thread onnx/defs/shape_inference.h Outdated
Comment thread onnx/defs/shape_inference.h Outdated
Comment thread onnx/shape_inference/implementation.cc
Comment thread onnx/shape_inference/implementation.cc Outdated
Comment thread onnx/shape_inference/implementation.cc Outdated
@BowenBao BowenBao force-pushed the bowbao/seq_related_ops branch from 82b81e9 to a980f1c Compare August 28, 2019 23:54
@BowenBao BowenBao changed the title [WIP] Sequence related ops Sequence related ops Aug 28, 2019
@BowenBao BowenBao force-pushed the bowbao/seq_related_ops branch 3 times, most recently from 7ba3605 to cf32e9f Compare September 3, 2019 21:12
@BowenBao
Copy link
Copy Markdown
Contributor Author

BowenBao commented Sep 3, 2019

@prasanthpul - can we include this in 1.6?

@linkerzhang @houseroad @postrational - for review

Comment thread onnx/defs/sequence/defs.cc Outdated
@prasanthpul prasanthpul added this to the 1.6 milestone Sep 4, 2019
@BowenBao BowenBao force-pushed the bowbao/seq_related_ops branch from 1d8edf1 to dfa81c6 Compare September 6, 2019 21:58
@BowenBao
Copy link
Copy Markdown
Contributor Author

BowenBao commented Sep 7, 2019

cc @wschin for review as well.

Comment thread docs/Changelog.md
Comment thread docs/Changelog.md Outdated
Comment thread docs/Changelog.md Outdated
@BowenBao BowenBao force-pushed the bowbao/seq_related_ops branch from dfa81c6 to 15d6506 Compare September 9, 2019 22:33
Comment thread docs/Operators.md
@gramalingam
Copy link
Copy Markdown
Contributor

Ideally, we should make all the sequence ops (except the Concat and Split versions) generic: that is, work for sequences of all kinds, not just sequences of tensors. Unfortunately, our type constraint specification language does not let us specify this currently. The type-constraint specification string allows us to say only things like "sequence(tensor(int))" and we need to generalize this to allow us to say "sequence(tensor(T))" where T denotes a type-variable (either constrained by other constraints or not). It would be great if we could do this, either as part of this PR or as a separate PR, depending on effort required.

Comment thread onnx/defs/sequence/defs.cc Outdated
@BowenBao BowenBao force-pushed the bowbao/seq_related_ops branch 2 times, most recently from a52e296 to 5c863d6 Compare September 12, 2019 23:52
Comment thread onnx/defs/sequence/defs.cc Outdated
Comment thread onnx/defs/sequence/defs.cc Outdated
@BowenBao BowenBao force-pushed the bowbao/seq_related_ops branch from 1094abd to 5cfd515 Compare September 13, 2019 18:13
@BowenBao
Copy link
Copy Markdown
Contributor Author

Thanks for your review @gramalingam !

Comment thread docs/Changelog.md Outdated
Comment thread docs/Changelog.md
Comment thread docs/Changelog.md Outdated
Comment thread docs/Changelog.md
Comment thread onnx/backend/test/case/model/sequence.py Outdated
Comment thread onnx/backend/test/case/model/sequence.py
Comment thread onnx/helper.py Outdated
Comment thread onnx/defs/sequence/defs.cc
Comment thread onnx/defs/sequence/defs.cc Outdated
Comment thread onnx/defs/sequence/defs.cc Outdated
@wschin wschin merged commit d7595f3 into onnx:master Sep 14, 2019
jcwchen pushed a commit to jcwchen/onnx that referenced this pull request Sep 23, 2020
* sequence related ops

* refine docs

* extend hasInputShape to Sequence

* refining naming and error checking

* refine descriptions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: operator Issues related to ONNX operators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants