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

infer old squeeze on known input shape and empty axes #5283

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

daquexian
Copy link
Member

the shape inference of squeeze 13 can handle the case that the input shape is known and the axes is unspecified, but that of older version squeezes not. This PR fixes it.

Signed-off-by: daquexian <daquexian566@gmail.com>
@daquexian daquexian added the shape inference Issues related to shape inference label Jun 4, 2023
@daquexian daquexian requested review from a team as code owners June 4, 2023 13:38
daquexian added a commit to onnx/optimizer that referenced this pull request Jun 4, 2023
Signed-off-by: daquexian <daquexian566@gmail.com>
if (!ctx.getInputType(0)->tensor_type().has_shape()) {
return;
}

ctx.getOutputType(0)->mutable_tensor_type()->mutable_shape();
const auto& input_shape = ctx.getInputType(0)->tensor_type().shape();
const auto input_ndim = input_shape.dim_size();
Copy link
Contributor

Choose a reason for hiding this comment

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

That seems to be the same code than above, could it be moved in one separate function?

operatorsetid.domain = ""
operatorsetid.version = 11
self._assert_inferred(
graph, [make_tensor_value_info("y", TensorProto.FLOAT, (3, 2))]
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess that the opset needs to be specified, eg., something like opset_imports=[helper.make_opsetid(ONNX_DOMAIN, 11)]

gramalingam and others added 2 commits August 28, 2023 10:28
@codecov
Copy link

codecov bot commented Oct 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
onnx/test/shape_inference_test.py 99.49% <100.00%> (+<0.01%) ⬆️

📢 Thoughts on this report? Let us know!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
shape inference Issues related to shape inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants