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

Return a Status instead of throw an exception in GetAttrs #10534

Merged
merged 2 commits into from
Feb 14, 2022
Merged

Conversation

snnn
Copy link
Member

@snnn snnn commented Feb 12, 2022

Description:

The return type of GetAttrs is Status, so it is better to return a Status instead of throwing an exception when errors happen.

It's very tricky that if you want to read a tensor shape from attrs, you can either use a std::vector or TensorShapeVector to store the data. However, if you use TensorShapeVector you must pre-compute the number of dimension before calling GetAttrs and resize the vector to the right size. std::vector doesn't have the restriction.

Motivation and Context

  • Why is this change required? What problem does it solve?

Make error message more readable.

  • If it fixes an open issue, please link to the issue here.

Copy link
Member

@yufenglee yufenglee left a comment

Choose a reason for hiding this comment

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

:shipit:

@snnn snnn merged commit 270dec7 into master Feb 14, 2022
@snnn snnn deleted the snnn/p99 branch February 14, 2022 21:24
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.

4 participants