Skip to content

[Bug]: CPU plugin compilation drops ReduceMax operations, changes output shape #33082

@hari-krishna2000

Description

@hari-krishna2000

OpenVINO Version

2025.3.0

Operating System

Other (Please specify in description)

Device used for inference

CPU

Framework

PyTorch

Model used

Custom TorchScript model converted to OpenVINO IR format

Issue description

OS: Ubuntu 22.04 LTS

After calling compile_model() with CPU device, the output shape of scalar outputs incorrectly changes from [1] to [1, 960]. Investigation using get_runtime_model() reveals that all 21 ReduceMax operations are dropped during CPU plugin compilation. The same holds for the GPU model.

The model's IR graph is correct - it shows ReduceMax_17: [1,960] -> [1] producing a scalar. But after CPU compilation, this reduction is missing and the output retains the intermediate shape [1, 960].

The model was converted from TorchScript using OpenVINO's PyTorch frontend.

Step-by-step reproduction

import openvino as ov

core = ov.Core()
model = core.read_model("model.xml")
model.reshape(input_size)

print("Before compile:")
print(len(model.get_ops()))
print(len([op for op in model.get_ops() if op.get_type_name() == 'ReduceMax'])})
print(model.outputs[0].get_partial_shape()})

compiled_model = core.compile_model(model, "CPU")
print(compiled_model.outputs[0].get_partial_shape()})

The latter shows up as 0; and the shape is changed.

Relevant log output

Issue submission checklist

  • I'm reporting an issue. It's not a question.
  • I checked the problem with the documentation, FAQ, open issues, Stack Overflow, etc., and have not found a solution.
  • There is reproducer code and related data files such as images, videos, models, etc.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions