#38442·openvino

[Bug]: CPU rejects every Reduce operation with an empty axes list when keep_dims=false

Author: lslusarczykCreated Sep 28, 2026Updated Sep 28, 2026
Labelsbugsupport_request

OpenVINO Version

Master Branch (df92bb1581)

Operating System

Other (Please specify in description)

Device used for inference

CPU

Framework

None

Model used

Minimal model built with the OpenVINO Python API

Issue description

An empty axes list is a legal input to every Reduce* operation: nothing is reduced, so the output keeps the shape of the input. The CPU plugin refuses to compile such a model and throws at compile time.

The failure is limited to keep_dims == false. With keep_dims == true the CPU plugin checks a different condition that an empty axes list satisfies, and rank-1 inputs are saved by the existing is_emulated_0d_as_1d exception, so the defect shows up at every rank >= 2.

Expected: the CPU plugin returns the input unchanged (the absolute value for ReduceL1 and ReduceL2), consistently with the reference implementation.

Not a duplicate of #35889: that one uses keepdims=1 and goes through the ONNX frontend, which emits an Identity instead of a Reduce when noop_with_empty_axes=1, so no Reduce node ever reaches the CPU plugin. This defect is in the CPU Reduce node itself and only affects keep_dims=false.

Step-by-step reproduction

python
import numpy as np
import openvino as ov
import openvino.opset13 as ops

x = ops.parameter([2, 2], ov.Type.f32, name="x")
axes = ops.constant(np.array([], dtype=np.int64))  # empty axes list: reduce nothing
model = ov.Model([ops.reduce_mean(x, axes, keep_dims=False)], [x])

data = np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32)
print("expected:", data.tolist())
print("CPU     :", np.array(ov.Core().compile_model(model, "CPU")(data)[0]).tolist())

Ran on Linux Mint 22.3

Relevant log output

bash
expected: [[1.0, 2.0], [3.0, 4.0]]
Traceback (most recent call last):
  File "/home/lucasso/Downloads/repro.py", line 11, in <module>
    print("CPU     :", np.array(ov.Core().compile_model(model, "CPU")(data)[0]).tolist())
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/build/lucasso/openvino/install_fix-cpu-reduce-empty-axes_Release/python/openvino/_ov_api.py", line 646, in compile_model
    super().compile_model(model, device_name, {} if config is None else config),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Exception from src/inference/src/cpp/core.cpp:117:
Exception from src/inference/src/dev/plugin.cpp:54:
Check '!invalid_config' failed at src/plugins/intel_cpu/src/nodes/reduce.cpp:2116:
ReduceMean node with name 'ReduceMean_4' gets incorrect number of input/output dimensions!

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.

Source: openvinotoolkit/openvino