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

Add scalar case if "then" and "else" subgraph output are scalar. #28444

Merged
merged 4 commits into from
Jan 16, 2025

Conversation

mangguo321
Copy link
Contributor

Details:

  • if "then" and "else" subgraph output shape are scalar, the if node output shape should be static and a scalar
  • ...

Tickets:

src/core/src/op/if.cpp Outdated Show resolved Hide resolved
src/core/src/op/if.cpp Outdated Show resolved Hide resolved
@praasz praasz removed the pr: needs tests PR needs tests updating label Jan 15, 2025
src/core/tests/type_prop/if.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@mitruska mitruska left a comment

Choose a reason for hiding this comment

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

There is one edge case to consider, beside that LGTM.

The updated logic interprets dynamic PartialShape(Dimension{0, 1}) also as a static single element input, while {0, 1} range for dynamic dimension theoretically means that the tensor is allowed to be empty.
If the fix doesn't require this assumption, I would suggest is_one_element to return true for static case only.

In fact dynamic rank should be applicable here, but the "Union of scalar and 1D case" has been added to avoid it, mentioned here #11499 (comment)

src/core/src/op/if.cpp Outdated Show resolved Hide resolved
src/core/tests/type_prop/if.cpp Show resolved Hide resolved
@mlukasze mlukasze enabled auto-merge January 16, 2025 05:52
@mlukasze mlukasze added this pull request to the merge queue Jan 16, 2025
Merged via the queue into openvinotoolkit:master with commit ed470e7 Jan 16, 2025
185 checks passed
MirceaDan99 pushed a commit to MirceaDan99/openvino that referenced this pull request Jan 22, 2025
…nvinotoolkit#28444)

### Details:
- *if "then" and "else" subgraph output shape are scalar, the if node
output shape should be static and a scalar*
 - *...*

### Tickets:
 - *[28235](openvinotoolkit#28235
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Core OpenVINO Core (aka ngraph)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants