Skip to content

Support seq(tensor), implement 2 sequence ops that use the new type.#1983

Merged
pranavsharma merged 53 commits intomasterfrom
fix_seq_tensor_type
Oct 7, 2019
Merged

Support seq(tensor), implement 2 sequence ops that use the new type.#1983
pranavsharma merged 53 commits intomasterfrom
fix_seq_tensor_type

Conversation

@pranavsharma
Copy link
Copy Markdown
Contributor

@pranavsharma pranavsharma commented Oct 3, 2019

Description: Support seq(tensor), implement 2 sequence ops that uses the new type.

Motivation and Context
The current implementation of seq(tensor) type is inadequate in that it doesn't account for the shape of the contained tensors. A bunch of sequence ops were added to opset11 that uses this type.

Pranav Sharma added 30 commits July 22, 2019 11:09
@pranavsharma
Copy link
Copy Markdown
Contributor Author

pranavsharma commented Oct 5, 2019

The recent commits make 2 updates

  • I changed the data type from vector to TensorSeq (see comments and explanation in TensorSeq.h)
  • I've also added support in the python API for inputs. Support for outputs will come in a follow up PR so that this PR doesn't block the implementation of the remaining sequence ops.

@pranavsharma pranavsharma changed the title (WIP) Support seq(tensor), implement 2 sequence ops that use the new type. Support seq(tensor), implement 2 sequence ops that use the new type. Oct 5, 2019
@pranavsharma
Copy link
Copy Markdown
Contributor Author

@skottmckay all the mandatory builds have passed and this is ready to to be reviewed again. Thanks!


// use the data type of the first tensor as the data type of the seq
seq_ptr->dtype = reinterpret_cast<const OrtValue*>(in[0])->Get<Tensor>().DataType();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should TensorSeq have a ctor that requires the data type to be set?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, let me check if there're other problems in doing this. Will address in follow up PR.

auto data = tensor.Data<T>();
if (!data) {
return OrtApis::CreateStatus(ORT_FAIL, "Encountered nullptr.");
auto& one_tensor = reinterpret_cast<const OrtValue*>(in[idx])->Get<Tensor>();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

reinterpret_cast<const OrtValue*> [](start = 23, length = 33)

Why do we need the reinterpret_cast?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

May be we don't. Probably a copy-paste error. Will address in follow up PR.

Copy link
Copy Markdown
Contributor

@skottmckay skottmckay left a comment

Choose a reason for hiding this comment

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

:shipit:

@pranavsharma pranavsharma merged commit ea60469 into master Oct 7, 2019
@prasanthpul prasanthpul deleted the fix_seq_tensor_type branch May 16, 2021 18:37
yuslepukhin pushed a commit that referenced this pull request Mar 17, 2026
## Describe your changes

Remove marshmallow version pin. The pipeline can pass now.

## Checklist before requesting a review
- [ ] Add unit tests for this change.
- [ ] Make sure all tests can pass.
- [ ] Update documents if necessary.
- [ ] Lint and apply fixes to your code by running `lintrunner -a`
- [ ] Is this a user-facing change? If yes, give a description of this
change to be included in the release notes.
- [ ] Is this PR including examples changes? If yes, please remember to
update [example
documentation](https://github.com/microsoft/Olive/blob/main/docs/source/examples.md)
in a follow-up PR.

## (Optional) Issue link
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