Skip to content

fix bug that ir_pb_converter introduces empty shape#3279

Merged
linkerzhang merged 6 commits intoonnx:masterfrom
daquexian:optimizer
Feb 20, 2021
Merged

fix bug that ir_pb_converter introduces empty shape#3279
linkerzhang merged 6 commits intoonnx:masterfrom
daquexian:optimizer

Conversation

@daquexian
Copy link
Copy Markdown
Member

@daquexian daquexian commented Feb 16, 2021

This PR solves microsoft/onnxruntime#6691

  1. Outputs of subgraph may not have elem_type or shape, so only set them when they really exist
  2. Export TypeProto as long as one of elem_type and shape is set
  3. Update Dimension to cover unknown dimension

Signed-off-by: daquexian <daquexian566@gmail.com>
@daquexian daquexian requested a review from a team as a code owner February 16, 2021 04:37
@daquexian daquexian changed the title fix bug that ir_pb_converter introducing empty shape fix bug that ir_pb_converter introduces empty shape Feb 16, 2021
Comment thread onnx/common/ir_pb_converter.cc Outdated
value_by_name_of[gp.output(i).name()]->setSizes(
tensorShapeProtoToDimensions(
gp.output(i).type().tensor_type().shape()));
const auto output_tensor_type = gp.output(i).type().tensor_type();
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.

const auto&

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed

Comment thread onnx/common/ir_pb_converter.cc Outdated
value_by_name_of[gp.value_info(i).name()]->setElemType(
gp.value_info(i).type().tensor_type().elem_type());
if (gp.value_info(i).type().tensor_type().has_shape()) {
const auto tensor_type = gp.value_info(i).type().tensor_type();
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.

const auto&

Signed-off-by: daquexian <daquexian566@gmail.com>
Signed-off-by: daquexian <daquexian566@gmail.com>
daquexian added a commit to onnx/optimizer that referenced this pull request Feb 17, 2021
Signed-off-by: daquexian <daquexian566@gmail.com>
Signed-off-by: daquexian <daquexian566@gmail.com>
daquexian added a commit to onnx/optimizer that referenced this pull request Feb 17, 2021
Signed-off-by: daquexian <daquexian566@gmail.com>
@linkerzhang linkerzhang merged commit fde37df into onnx:master Feb 20, 2021
neginraoof pushed a commit to neginraoof/onnx that referenced this pull request Feb 22, 2021
* fix bug that introducing empty shape

Signed-off-by: daquexian <daquexian566@gmail.com>

* const auto -> const auto&

Signed-off-by: daquexian <daquexian566@gmail.com>

* fix bug about ValueInfoProto and Dimension

Signed-off-by: daquexian <daquexian566@gmail.com>

* fix more inconsistence

Signed-off-by: daquexian <daquexian566@gmail.com>

Co-authored-by: Ke Zhang <linkerzhang@yeah.net>
Signed-off-by: neginraoof <neginmr@utexas.edu>
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.

3 participants