Xenova's picture
Xenova HF Staff
sync 2e7068faf55e
50c1187 verified
Raw
History Blame
19.2 kB
{
"op": "ai.onnx.Upsample",
"cases": [
{
"name": "nearest_2x_f32",
"inputs": {
"x": { "dtype": "float32", "shape": [1, 1, 2, 2], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0] } },
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 2.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 1, 4, 4], "tolerance": 0 } }
},
{
"name": "nearest_2x_nonsquare_f32",
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 1, 2, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 2.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 1, 4, 6], "tolerance": 0 } }
},
{
"name": "linear_2x_nonsquare_f32",
"attrs": { "mode": "linear" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 1, 2, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 2.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 1, 4, 6], "tolerance": 0.000001 } }
},
{
"name": "nearest_3x_multichannel_f32",
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 2, 2],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 3.0, 3.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 6, 6], "tolerance": 0 } }
},
{
"name": "nearest_2x_f16",
"attrs": { "mode": "nearest" },
"inputs": {
"x": { "dtype": "float16", "shape": [1, 1, 2, 2], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0] } },
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 2.0] } }
},
"outputs": { "y": { "dtype": "float16", "shape": [1, 1, 4, 4], "tolerance": 0.001 } }
},
{
"name": "ort_nearest_non_integer_width_scale",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/upsample_op_test.cc",
"test": "UpsampleOpTest.UpsampleOpNearest15XTest"
},
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 2, 2],
"data": { "kind": "values", "values": [1.0, 3.0, 3.0, 5.0, 3.0, 5.0, 7.0, 9.0] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 1.5] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 4, 3], "tolerance": 0 } }
},
{
"name": "ort_linear_4d_nchw_scale_2x4",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/upsample_op_test.cc",
"test": "UpsampleOpTest.UpsampleOp4DBilinearTest"
},
"attrs": { "mode": "linear" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 1, 2, 2],
"data": { "kind": "values", "values": [1.0, 3.0, 3.0, 5.0, 3.0, 5.0, 7.0, 9.0] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 4.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [2, 1, 4, 8], "tolerance": 0.000001 } }
},
{
"name": "ort_nearest_2x_nchw_two_channels",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/upsample_op_test.cc",
"test": "UpsampleOpTest.UpsampleOpNearest2XTest"
},
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 2, 2],
"data": { "kind": "values", "values": [1.0, 3.0, 3.0, 5.0, 3.0, 5.0, 7.0, 9.0] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 2.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 4, 4], "tolerance": 0 } }
},
{
"name": "ort_nearest_2x3_nchw_two_channels",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/upsample_op_test.cc",
"test": "UpsampleOpTest.UpsampleOpNearestTest"
},
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 2, 2],
"data": { "kind": "values", "values": [1.0, 3.0, 3.0, 5.0, 3.0, 5.0, 7.0, 9.0] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 3.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 4, 6], "tolerance": 0 } }
},
{
"name": "ort_linear_4d_noop_scales",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/upsample_op_test.cc",
"test": "UpsampleOpTest.UpsampleOp4DBilinearTest_ScalesNoOp"
},
"attrs": { "mode": "linear" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [2, 1, 2, 2],
"data": { "kind": "values", "values": [1.0, 3.0, 3.0, 5.0, 3.0, 5.0, 7.0, 9.0] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 1.0, 1.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [2, 1, 2, 2], "tolerance": 0.000001 } }
},
{
"name": "ort_nearest_4d_noop_scales",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/upsample_op_test.cc",
"test": "UpsampleOpTest.UpsampleOpNearestTest_NoScale"
},
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 2, 2],
"data": { "kind": "values", "values": [1.0, 3.0, 3.0, 5.0, 3.0, 5.0, 7.0, 9.0] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 1.0, 1.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 2, 2], "tolerance": 0 } }
},
{
"name": "ort_nearest_batch_height_width_scale",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/upsample_op_test.cc",
"test": "UpsampleOpTest.UpsampleOpNearest222XTest"
},
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 2, 2],
"data": { "kind": "values", "values": [1.0, 3.0, 3.0, 5.0, 3.0, 5.0, 7.0, 9.0] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [2.0, 1.0, 2.0, 2.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [2, 2, 4, 4], "tolerance": 0 } }
},
{
"name": "ort_nearest_nhwc_axis_scaling",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/upsample_op_test.cc",
"test": "UpsampleOpTest.NhwcUpsampleOpNearestTest"
},
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 2, 2],
"data": { "kind": "values", "values": [1.0, 3.0, 3.0, 5.0, 3.0, 5.0, 7.0, 9.0] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 1.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 4, 6, 2], "tolerance": 0 } }
},
{
"name": "ort_nearest_int32_nchw_2x3",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/upsample_op_test.cc",
"test": "UpsampleOpTest.UpsampleOpNearestTest_int32"
},
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "int32",
"shape": [1, 2, 2, 2],
"data": { "kind": "values", "values": [1, 3, 3, 5, 3, 5, 7, 9] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 3.0] } }
},
"outputs": { "y": { "dtype": "int32", "shape": [1, 2, 4, 6], "tolerance": 0 } }
},
{
"name": "ort_nearest_uint8_nchw_2x3",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/upsample_op_test.cc",
"test": "UpsampleOpTest.UpsampleOpNearestTest_uint8",
"notes": "ONNX uint8 is represented as one logical value per 32-bit fixture slot."
},
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "uint8",
"shape": [1, 2, 2, 2],
"data": { "kind": "values", "values": [1, 3, 3, 5, 3, 5, 7, 9] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 3.0] } }
},
"outputs": { "y": { "dtype": "uint8", "shape": [1, 2, 4, 6], "tolerance": 0 } }
},
{
"name": "nearest_int8_negative_values_2x",
"attrs": { "mode": "nearest" },
"inputs": {
"x": { "dtype": "int8", "shape": [1, 1, 2, 2], "data": { "kind": "values", "values": [-8, 3, 7, -1] } },
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 2.0] } }
},
"outputs": {
"y": {
"dtype": "int8",
"shape": [1, 1, 4, 4],
"tolerance": 0,
"data": { "kind": "values", "values": [-8, -8, 3, 3, -8, -8, 3, 3, 7, 7, -1, -1, 7, 7, -1, -1] }
}
},
"provenance": {
"notes": "Synthetic signed-int8 nearest-neighbor witness. Negative and positive values prove the widened i32 load/store route preserves logical int8 values instead of treating them as uint8."
}
},
{
"name": "onnx_backend_nearest_2x3_f32",
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_upsample_nearest" },
"attrs": { "mode": "nearest" },
"inputs": {
"x": { "dtype": "float32", "shape": [1, 1, 2, 2], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0] } },
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 3.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 1, 4, 6], "tolerance": 0 } }
},
{
"name": "ort_nearest_rank1_2x",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/upsample_op_test.cc",
"test": "UpsampleOpTest.UpsampleOpNearestTest_1D",
"notes": "Deprecated Upsample nearest is rank-generic."
},
"attrs": { "mode": "nearest" },
"inputs": {
"x": { "dtype": "float32", "shape": [5], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0] } },
"scales": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [2.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [10], "tolerance": 0 } }
},
{
"name": "ort_linear_rank2_2x4",
"provenance": {
"source": "onnxruntime/test/providers/cpu/tensor/upsample_op_test.cc",
"test": "UpsampleOpTest.UpsampleOp2DBilinearTest",
"notes": "Deprecated Upsample linear accepts rank-2 inputs."
},
"attrs": { "mode": "linear" },
"inputs": {
"x": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [1.0, 3.0, 3.0, 5.0] } },
"scales": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [2.0, 4.0] } }
},
"outputs": {
"y": {
"dtype": "float32",
"shape": [4, 8],
"data": {
"kind": "values",
"values": [1.0, 1.5, 2.0, 2.5, 3.0, 3.0, 3.0, 3.0, 2.0, 2.5, 3.0, 3.5, 4.0, 4.0, 4.0, 4.0, 3.0, 3.5, 4.0, 4.5, 5.0, 5.0, 5.0, 5.0, 3.0, 3.5, 4.0, 4.5, 5.0, 5.0, 5.0, 5.0]
},
"tolerance": 0
}
}
},
{
"name": "nearest_4x_integer_scale_vec4",
"attrs": { "mode": "nearest" },
"inputs": {
"x": { "dtype": "float32", "shape": [1, 1, 2, 2], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0] } },
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 4.0, 4.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 1, 8, 8], "tolerance": 0 } }
},
{
"name": "nearest_2x_larger_grid",
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 32, 32],
"data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.29 }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 2.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 64, 64], "tolerance": 0 } }
},
{
"name": "linear_2x_stencil_multichannel",
"attrs": { "mode": "linear" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 2, 8, 12],
"data": { "kind": "fillFloat32", "sinStep": 0.21, "cosStep": 0.33 }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 2.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 16, 24] } }
},
{
"name": "empty_zero_dim",
"attrs": { "mode": "nearest" },
"inputs": {
"x": { "dtype": "float32", "shape": [0, 1, 2, 2], "data": { "kind": "values", "values": [] } },
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 2.0] } }
},
"outputs": { "y": { "dtype": "float32", "shape": [0, 1, 4, 4], "tolerance": 0 } }
},
{
"name": "empty_zero_dim_f16",
"attrs": { "mode": "nearest" },
"inputs": {
"x": { "dtype": "float16", "shape": [0, 1, 2, 2], "data": { "kind": "values", "values": [] } },
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 2.0] } }
},
"outputs": { "y": { "dtype": "float16", "shape": [0, 1, 4, 4], "tolerance": 0 } }
},
{
"name": "linear_2x_f16_featuremap",
"attrs": { "mode": "linear" },
"inputs": {
"x": {
"dtype": "float16",
"shape": [1, 16, 32, 32],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.31 }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 2.0] } }
},
"outputs": { "y": { "dtype": "float16", "shape": [1, 16, 64, 64], "tolerance": 0.02 } }
},
{
"name": "nearest_1point5x_f16_scalar_fallback",
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "float16",
"shape": [1, 8, 30, 30],
"data": { "kind": "fillFloat32", "sinStep": 0.23, "cosStep": 0.19 }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 1.5, 1.5] } }
},
"outputs": { "y": { "dtype": "float16", "shape": [1, 8, 45, 45], "tolerance": 0.01 } }
},
{
"name": "linear_nonint_f16_scalar_fallback",
"attrs": { "mode": "linear" },
"inputs": {
"x": {
"dtype": "float16",
"shape": [1, 4, 28, 26],
"data": { "kind": "fillFloat32", "sinStep": 0.29, "cosStep": 0.13 }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 1.5, 1.5] } }
},
"outputs": { "y": { "dtype": "float16", "shape": [1, 4, 42, 39], "tolerance": 0.02 } }
},
{
"name": "nearest_noninteger_wscale_scales_input_ignored_vec4",
"attrs": { "mode": "nearest" },
"inputs": {
"x": { "dtype": "float32", "shape": [1, 1, 1, 2], "data": { "kind": "values", "values": [10.0, 20.0] } },
"scales": {
"dtype": "float32",
"shape": [4],
"data": { "kind": "values", "values": [1.0, 1.0, 1.0, 2.3333333] }
}
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 4], "tolerance": 0 } }
},
{
"name": "nearest_noninteger_wscale_scales_input_ignored_scalar",
"attrs": { "mode": "nearest" },
"inputs": {
"x": { "dtype": "float32", "shape": [1, 1, 1, 2], "data": { "kind": "values", "values": [10.0, 20.0] } },
"scales": {
"dtype": "float32",
"shape": [4],
"data": { "kind": "values", "values": [1.0, 1.0, 1.0, 3.3333333] }
}
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 6], "tolerance": 0 } }
},
{
"name": "nearest_rank5_noninteger_scale_generic_ignored",
"attrs": { "mode": "nearest" },
"inputs": {
"x": { "dtype": "float32", "shape": [1, 1, 1, 1, 2], "data": { "kind": "values", "values": [10.0, 20.0] } },
"scales": {
"dtype": "float32",
"shape": [5],
"data": { "kind": "values", "values": [1.0, 1.0, 1.0, 1.0, 2.3333333] }
}
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 1, 1, 1, 4], "tolerance": 0 } }
},
{
"name": "nearest_2x_uint8_vec4_store",
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "uint8",
"shape": [1, 1, 2, 4],
"data": { "kind": "values", "values": [1, 2, 3, 4, 5, 6, 7, 8] }
},
"scales": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 2.0, 2.0] } }
},
"outputs": { "y": { "dtype": "uint8", "shape": [1, 1, 4, 8], "tolerance": 0 } }
},
{
"name": "rank7_nearest_last_axis",
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 1, 2, 1, 2, 1, 3],
"data": { "kind": "linspace", "start": 0.0, "end": 11.0 }
},
"scales": {
"dtype": "float32",
"shape": [7],
"data": { "kind": "values", "values": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0] }
}
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 1, 2, 1, 2, 1, 6], "tolerance": 0 } }
},
{
"name": "rank8_nearest_last_axis",
"attrs": { "mode": "nearest" },
"inputs": {
"x": {
"dtype": "float32",
"shape": [1, 1, 2, 1, 2, 1, 2, 3],
"data": { "kind": "linspace", "start": 1.0, "end": 24.0 }
},
"scales": {
"dtype": "float32",
"shape": [8],
"data": { "kind": "values", "values": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0] }
}
},
"outputs": { "y": { "dtype": "float32", "shape": [1, 1, 2, 1, 2, 1, 2, 6], "tolerance": 0 } }
}
]
}