Skip to content

[Bug]: OpenVINO CPU ReduceLogSumExp overflows to inf for large FP32 inputs #35648

@ALinrunrun

Description

@ALinrunrun

OpenVINO Version

2026.1.0

Operating System

Other (Please specify in description)

Device used for inference

CPU

Framework

ONNX

Model used

Minimal ONNX model generated by the reproducer script.

Issue description

OpenVINO CPU returns inf for ReduceLogSumExp on large FP32 inputs.

For the same valid ONNX model, ONNX Runtime and a stable NumPy reference return finite values. OpenVINO appears to overflow internally for inputs near or above the FP32 exp overflow range.

OS: Ubuntu 24.04.2 LTS / Linux x86_64

Step-by-step reproduction

#!/usr/bin/env python3
import sys
import numpy as np
import onnx
import onnxruntime as ort
import openvino as ov
from onnx import TensorProto, helper

x = np.array(
    [[100.0, 88.0, 50.0], [200.0, -10.0, 1.0]],
    dtype=np.float32,
)

m = x.max(axis=1, keepdims=True)
stable_ref = (m + np.log(np.sum(np.exp(x - m), axis=1, keepdims=True))).squeeze(1)

X = helper.make_tensor_value_info("X", TensorProto.FLOAT, [2, 3])
Y = helper.make_tensor_value_info("Y", TensorProto.FLOAT, [2])

node = helper.make_node("ReduceLogSumExp", ["X"], ["Y"], axes=[1], keepdims=0)
graph = helper.make_graph([node], "reducelogsumexp_overflow", [X], [Y])
model = helper.make_model(graph, opset_imports=[helper.make_opsetid("", 13)])
model.ir_version = 8
onnx.checker.check_model(model)

mb = model.SerializeToString()
feed = {"X": x}

ort_out = ort.InferenceSession(
    mb,
    providers=["CPUExecutionProvider"],
).run(None, feed)[0]

core = ov.Core()
compiled = core.compile_model(core.read_model(mb, b""), "CPU")
ov_out = compiled(feed)[compiled.output(0)]

print(f"Input x    : {x}")
print(f"ORT out    : {ort_out}")
print(f"OpenVINO   : {ov_out}")
print(f"Stable ref : {stable_ref}")

ort_finite = np.all(np.isfinite(ort_out))
ov_has_inf = np.any(np.isinf(ov_out))
ort_close = np.allclose(ort_out, stable_ref, atol=1e-3, rtol=1e-5)

print(f"\nORT finite?        {ort_finite}")
print(f"ORT close to ref?  {ort_close}")
print(f"OpenVINO has inf?  {ov_has_inf}")

if ort_finite and ort_close and ov_has_inf:
    print("\nBUG REPRODUCED: OpenVINO ReduceLogSumExp overflows to inf.")
    sys.exit(0)

print("\nNOT REPRODUCED")
sys.exit(1)

Relevant log output

Expected:
OpenVINO CPU should return finite ReduceLogSumExp results consistent with ONNX Runtime and a stable reference implementation.

Actual:
Input x    : [[100.  88.  50.]
 [200. -10.   1.]]
ORT out    : [100.00001 200.     ]
OpenVINO   : [inf inf]
Stable ref : [100.00001 200.     ]

ORT finite?        True
ORT close to ref?  True
OpenVINO has inf?  True

BUG REPRODUCED: OpenVINO ReduceLogSumExp overflows to inf.

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

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions