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

[GPU] Update creating SpaceToBatch and BatchToSpace for dynamic and static #29415

Merged

Conversation

kelvinchoi-intel
Copy link
Contributor

@kelvinchoi-intel kelvinchoi-intel commented Mar 12, 2025

Details:

  • Update creating SpaceToBatch and BatchToSpace for dynamic and static case

Tickets:

  • 101355
  • 164591

@kelvinchoi-intel kelvinchoi-intel requested review from a team as code owners March 12, 2025 06:24
@github-actions github-actions bot added the category: GPU OpenVINO GPU plugin label Mar 12, 2025
auto output_pshape = op->get_output_partial_shape(0);
auto out_size = output_pshape.is_static() ? tensor_from_dims(output_pshape.to_shape()) : cldnn::tensor();

if (non_constant_input) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain the behavior? I cannot understand how it would work. For example, if the model is static but input is not constant (!op->is_dynamic() && non_constant_input), I guess it should go through the "then" block of if. (batch_to_space(layerName, inputs, out_size)) But with your change, it would go to "else" block of if. I guess that wouldn't work.

Copy link
Contributor Author

@kelvinchoi-intel kelvinchoi-intel Mar 18, 2025

Choose a reason for hiding this comment

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

This code to check if it is constant or not is old (about 1.5 years ago) and is no longer needed, because in recent OpenVINO, we don't care if the input is a constant node or a parameter node. Instead of checking if it is a constant node, we need to check for dynamic because we need a dummy for the dynamic case.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is a code std::vector<int32_t> sizes = inConst->cast_vector<int32_t>(); below. It assumes that the input is a constant node. It conflicts with what you are saying ("in recent OpenVINO, we don't care if the input is a constant node or a parameter node"). If it is not needed to check constantness, isn't it necessary to remove the whole "else" block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for my misunderstanding. The spaceToBatch and batchToSpace ops need to check constantness to support legacy for old_shape_infer. PR is updated.

@isanghao isanghao added this pull request to the merge queue Apr 3, 2025
Merged via the queue into openvinotoolkit:master with commit 1eab89f Apr 3, 2025
168 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: GPU OpenVINO GPU plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants