Skip to content

[Bug]: Interpolate/Resize with cubic mode produces garbage values on GPU devices #33459

@zhihaoxu1325

Description

@zhihaoxu1325

OpenVINO Version

2025.4.0

Operating System

Ubuntu 20.04 (LTS)

Device used for inference

GPU

Framework

None

Model used

No response

Issue description

The GPU plugin produces completely incorrect (garbage) values when executing Interpolate (ONNX Resize) operation with cubic mode. Only align_corners coordinate transformation mode works correctly; all other modes produce garbage values.

Affected Configuration
Parameter : mode
Affected Values: cubic
Working Values: nearest, linear

Root Cause Hypothesis
The GPU kernel for cubic interpolation with non-align_corners coordinate transformation modes appears to be reading from uninitialized memory or has incorrect address calculations. The output values (e.g., ±1e27 to ±1e29) suggest reading garbage memory rather than a computational error.

Step-by-step reproduction

Please run the Minimal Reproduction code:

import numpy as np
import onnx
from onnx import helper, TensorProto
import openvino as ov

# Create ONNX Resize model with cubic mode
input_shape = [1, 1, 4, 4]
output_shape = [1, 1, 2, 2]

X = helper.make_tensor_value_info('X', TensorProto.FLOAT, input_shape)
Y = helper.make_tensor_value_info('Y', TensorProto.FLOAT, output_shape)

roi = helper.make_tensor('roi', TensorProto.FLOAT, [0], [])
scales = helper.make_tensor('scales', TensorProto.FLOAT, [0], [])
sizes = helper.make_tensor('sizes', TensorProto.INT64, [4], output_shape)

resize_node = helper.make_node(
    'Resize',
    inputs=['X', 'roi', 'scales', 'sizes'],
    outputs=['Y'],
    mode='cubic',
    coordinate_transformation_mode='half_pixel',
)

graph = helper.make_graph([resize_node], 'resize_test', [X], [Y], [roi, scales, sizes])
model = helper.make_model(graph, opset_imports=[helper.make_opsetid('', 13)])
onnx.save(model, 'test_resize_cubic.onnx')

# Test
core = ov.Core()
ov_model = core.read_model('test_resize_cubic.onnx')

np.random.seed(42)
input_data = np.random.rand(*input_shape).astype(np.float32) * 100

cpu_result = np.array(core.compile_model(ov_model, "CPU")([input_data])[0])
gpu_result = np.array(core.compile_model(ov_model, "GPU")([input_data])[0])

print(f"CPU output: {cpu_result.flatten()}")
print(f"GPU output: {gpu_result.flatten()}")
print(f"CPU range: [{cpu_result.min():.2f}, {cpu_result.max():.2f}]")
print(f"GPU range: [{gpu_result.min():.2e}, {gpu_result.max():.2e}]")

if np.allclose(cpu_result, gpu_result, rtol=1e-3):
    print("Status: OK")
else:
    print("Status: BUG - GPU produces garbage values")

Relevant log output

75 warnings generated.
CPU output: [37.22346  55.096306 67.40731  30.31975 ]
GPU output: [nan nan nan nan]
CPU range: [30.32, 67.41]
GPU range: [nan, nan]
Status: BUG - GPU produces garbage values

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

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions