Skip to content

[Bug]: Interpolate with cubic mode produces NaN when input spatial size is 1x1 on GPU devices #33447

@zhihaoxu1325

Description

@zhihaoxu1325

OpenVINO Version

2026.0.0

Operating System

Ubuntu 20.04 (LTS)

Device used for inference

GPU

Framework

None

Model used

No response

Issue description

When using Interpolate operator with mode=cubic on GPU, the output contains NaN values if the input spatial dimensions are 1x1. CPU produces correct results for the same input.

Operator attributes:

mode: cubic
shape_calculation_mode: sizes
coordinate_transformation_mode: half_pixel
nearest_mode: floor
antialias: False
pads_begin: [0, 0, 0, 0]
pads_end: [0, 0, 0, 0]
cube_coeff: -0.75
Input/Output shapes:

Input: [1, 1, 1, 1] (float32)
Output: [1, 1, 2, 2] (float32)
Results:

CPU output: [25.378757, 25.378757, 25.378757, 25.378757]
GPU output: [nan, nan, nan, nan]

Step-by-step reproduction

Download the attached files: resize_bug.xml, resize_bug.bin, resize_bug_inputs.npz

resize.zip

Run the reproducer script

import numpy as np
import openvino as ov

def main():
    print("=" * 70)
    print("OpenVINO GPU Bug: Interpolate (cubic) NaN on 1x1 input")
    print("=" * 70)
    
    core = ov.Core()
    print(f"OpenVINO version: {ov.__version__}")
    print(f"Available devices: {core.available_devices}")
    
    model = core.read_model("resize_bug.xml")
    print("\nModel loaded: resize_bug.xml")
    
    
    print("\nModel inputs:")
    for inp in model.inputs:
        print(f"  {inp.get_any_name()}: {inp.get_shape()}, {inp.get_element_type()}")
    print("Model outputs:")
    for out in model.outputs:
        print(f"  {out.get_any_name()}: {out.get_shape()}, {out.get_element_type()}")
    
   
    inputs_npz = np.load("resize_bug_inputs.npz")
    inputs = {name: inputs_npz[name] for name in inputs_npz.files}
    print("\nInputs loaded: resize_bug_inputs.npz")
    for name, arr in inputs.items():
        print(f"  {name}: shape={arr.shape}, dtype={arr.dtype}, values={arr.flatten()[:3]}")
    
    
    print("\n" + "-" * 70)
    print("CPU Inference:")
    cpu_compiled = core.compile_model(model, "CPU")
    cpu_result = np.array(cpu_compiled(inputs)[0], copy=True)
    print(f"  Output: {cpu_result.flatten()}")
    print(f"  Has NaN: {np.any(np.isnan(cpu_result))}")
    
    print("\n" + "-" * 70)
    print("GPU Inference:")
    gpu_compiled = core.compile_model(model, "GPU")
    gpu_result = np.array(gpu_compiled(inputs)[0], copy=True)
    print(f"  Output: {gpu_result.flatten()}")
    print(f"  Has NaN: {np.any(np.isnan(gpu_result))}")
    
    print("\n" + "=" * 70)
    if np.any(np.isnan(gpu_result)) and not np.any(np.isnan(cpu_result)):
        print("❌ BUG CONFIRMED: GPU produces NaN, CPU is correct")
    elif not np.allclose(cpu_result, gpu_result, rtol=1e-3, atol=1e-5, equal_nan=True):
        print(f"⚠️  Mismatch: max diff = {np.nanmax(np.abs(cpu_result - gpu_result))}")
    else:
        print("✓ No bug detected")

if __name__ == "__main__":
    main()

Relevant log output

======================================================================
OpenVINO GPU Bug: Interpolate (cubic) NaN on 1x1 input
======================================================================
OpenVINO version: 2026.0.0-20742-6ea81c056f0
Available devices: ['CPU', 'GPU']

Model loaded: resize_bug.xml

Model inputs:
  v23_0: [1,1,1,1], <Type: 'float32'>
  v45_0: [2,1], <Type: 'float32'>
  v32_0: [], <Type: 'float32'>
  v12_0: [1], <Type: 'float32'>
  v3_0: [], <Type: 'char'>
Model outputs:
  /Resize_output_0: [1,1,2,2], <Type: 'float32'>

Inputs loaded: resize_bug_inputs.npz
  v23_0: shape=(1, 1, 1, 1), dtype=float32, values=[4.6069603]
  v45_0: shape=(2, 1), dtype=float32, values=[3.4742732 6.3095818]
  v32_0: shape=(), dtype=float32, values=[4.5283375]
  v12_0: shape=(1,), dtype=float32, values=[5.6419754]
  v3_0: shape=(), dtype=bool, values=[ True]

----------------------------------------------------------------------
CPU Inference:
  Output: [25.38357 25.38357 25.38357 25.38357]
  Has NaN: False

----------------------------------------------------------------------
GPU Inference:
  Output: [nan nan nan nan]
  Has NaN: True

======================================================================
❌ BUG CONFIRMED: GPU produces NaN, CPU is correct

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