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

Handle Reshape's special zero in SimplifySecondInputOfReshape #20785

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

mateusztabaka
Copy link
Contributor

@mateusztabaka mateusztabaka commented Oct 31, 2023

SimplifySecondInputOfReshape detects ShapeOf->Gather->Concat subgraphs on Reshape's second input and replaces ShapeOf->Gather with a Constant with zero(s). Currently it works only with Reshapes that have special_zero set to true, but it can work for Reshapes with special_zero == false if non-Gather inputs to Concat are Constants and don't contain any zero.

image

Now for special_zero == false case, the transformation checks that all inputs Constants to Concat don't contain 0 values and sets special_zero = true flag to Reshape operation.

Ticket: CVS-123434

SimplifySecondInputOfReshape detects ShapeOf->Gather->Concat
subgraphs on Reshape's second input and replaces ShapeOf->Gather
with a Constant with zero(s). Currently it works only with Reshapes
that have special_zero set to true, but it can work for Reshapes
with special_zero == false if non-Gather inputs to Concat are Constants
and don't contain any zero.

Ticket: CVS-123434
@mateusztabaka mateusztabaka requested a review from a team as a code owner October 31, 2023 08:45
@github-actions github-actions bot added the category: transformations OpenVINO Runtime library - Transformations label Oct 31, 2023
@itikhono itikhono self-requested a review October 31, 2023 15:22
@itikhono itikhono requested a review from slyalin November 1, 2023 12:51
}
comparator.enable(FunctionsComparator::ATTRIBUTES);
comparator.enable(FunctionsComparator::CONST_VALUES);
}
Copy link
Contributor

@slyalin slyalin Nov 1, 2023

Choose a reason for hiding this comment

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

Can we use existing test and specialize them with special_zero=false? What's so special for these two cases?

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we can improve this point in the next PR

@itikhono itikhono merged commit 4084e9a into openvinotoolkit:master Nov 1, 2023
34 checks passed
@mateusztabaka mateusztabaka deleted the simplify_second branch November 2, 2023 08:21
andrei-kochin pushed a commit that referenced this pull request Nov 2, 2023
#20820)

* Handle Reshape's special zero in SimplifySecondInputOfReshape

SimplifySecondInputOfReshape detects ShapeOf->Gather->Concat
subgraphs on Reshape's second input and replaces ShapeOf->Gather
with a Constant with zero(s). Currently it works only with Reshapes
that have special_zero set to true, but it can work for Reshapes
with special_zero == false if non-Gather inputs to Concat are Constants
and don't contain any zero.

Ticket: CVS-123434

* fix no default output

Co-authored-by: Mateusz Tabaka <mateusz.tabaka@intel.com>
alvoron pushed a commit to alvoron/openvino that referenced this pull request Nov 6, 2023
…notoolkit#20785)

* Handle Reshape's special zero in SimplifySecondInputOfReshape

SimplifySecondInputOfReshape detects ShapeOf->Gather->Concat
subgraphs on Reshape's second input and replaces ShapeOf->Gather
with a Constant with zero(s). Currently it works only with Reshapes
that have special_zero set to true, but it can work for Reshapes
with special_zero == false if non-Gather inputs to Concat are Constants
and don't contain any zero.

Ticket: CVS-123434

* fix no default output
allnes pushed a commit to allnes/openvino that referenced this pull request Nov 23, 2023
…notoolkit#20785)

* Handle Reshape's special zero in SimplifySecondInputOfReshape

SimplifySecondInputOfReshape detects ShapeOf->Gather->Concat
subgraphs on Reshape's second input and replaces ShapeOf->Gather
with a Constant with zero(s). Currently it works only with Reshapes
that have special_zero set to true, but it can work for Reshapes
with special_zero == false if non-Gather inputs to Concat are Constants
and don't contain any zero.

Ticket: CVS-123434

* fix no default output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: transformations OpenVINO Runtime library - Transformations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants