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

[Conformance] Fix input shape generation for Broadcast (f32) #29515

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

TempestBirds729804
Copy link

@TempestBirds729804 TempestBirds729804 commented Mar 17, 2025

Fix Broadcast operation conformance test failure (f32)

Description

In this PR, I fixed a conformance test failure in the Broadcast operation (opset3, type=f32), where the input tensor shape did not meet NumPy broadcasting rules and caused shape inference errors.

In the original test scenario, input[0] was a data tensor with incompatible shape (e.g., [37, 15, 15]), and input[1] : the target shape was a Constant (e.g., [37, 37, 128]). The generated input[0] could not be broadcast correctly, leading to inference failure in the TEMPLATE plugin.

Solution

A custom input shape adjustment logic has been added in generate_inputs.cpp. Specifically:

  • If the Broadcast operation uses NumPy mode,
  • And the output shape is static,
  • The generator adjusts input[0] by replacing incompatible dimensions with 1 (when they do not match the target shape or output shape), ensuring compliance with NumPy broadcasting rules.

Test Result

The Broadcast.3_Type=f32 conformance test now passes successfully.

However, the Broadcast.3_Type=i64 test case still fails. Based on the analysis, the cause is different:

  • In this case, input[1] (target shape) is a Parameter instead of a Constant.
  • The test framework auto-generates values for this Parameter, which may not conform to broadcasting rules.
  • As the i64 failure is related to the framework’s input generation for input[1], and not input[0], this PR focuses solely on fixing the f32 case.

Note: I'm happy to follow up with a separate fix for the i64 case if needed (e.g., by improving test model generation or adjusting framework behavior). Feedback and suggestions are welcome! 🙂

Related Issue

Fixes #23549

@TempestBirds729804 TempestBirds729804 requested review from a team as code owners March 17, 2025 15:23
@github-actions github-actions bot added the category: IE Tests OpenVINO Test: plugins and common label Mar 17, 2025
@sys-openvino-ci sys-openvino-ci added the ExternalPR External contributor label Mar 17, 2025
@p-wysocki p-wysocki requested a review from iefode March 24, 2025 11:17
@p-wysocki
Copy link
Contributor

Thanks for the PR!

bump @iefode

@TempestBirds729804
Copy link
Author

Thanks for the PR!

bump @iefode
U welcome! Have a nice day bro🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: IE Tests OpenVINO Test: plugins and common ExternalPR External contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Good First Issue]: [OP CONFORMANCE][TEMPLATE] 2 broadcast tests are failed in op conformance
3 participants