[ONNX importer] Add more Resize-10 tests (#1026)

This commit is contained in:
Katarzyna Mitrus 2020-07-03 13:43:46 +02:00 committed by GitHub
parent f15b5f2b60
commit 38335b1883
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 411 additions and 7 deletions

View File

@ -0,0 +1,82 @@
ir_version: 7
producer_name: "onnx-importer-test"
graph {
node {
output: "scales"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 4
data_type: 1
float_data: 1.0
float_data: 1.0
float_data: 0.6000000238418579
float_data: 0.6000000238418579
name: "const_tensor"
}
type: TENSOR
}
}
node {
input: "X"
input: "scales"
output: "Y"
op_type: "Resize"
attribute {
name: "mode"
s: "linear"
type: STRING
}
}
name: "test-model"
input {
name: "X"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 4
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
domain: ""
version: 10
}

View File

@ -0,0 +1,81 @@
ir_version: 7
producer_name: "onnx-importer-test"
graph {
node {
output: "scales"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 4
data_type: 1
float_data: 1.0
float_data: 1.0
float_data: 0.6000000238418579
float_data: 0.6000000238418579
name: "const_tensor"
}
type: TENSOR
}
}
node {
input: "X"
input: "scales"
output: "Y"
op_type: "Resize"
attribute {
name: "mode"
s: "nearest"
type: STRING
}
}
name: "test-model"
input {
name: "X"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 4
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
domain: ""
version: 10
}

View File

@ -0,0 +1,82 @@
ir_version: 7
producer_name: "onnx-importer-test"
graph {
node {
output: "scales"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 4
data_type: 1
float_data: 1.0
float_data: 1.0
float_data: 2.0
float_data: 2.0
name: "const_tensor"
}
type: TENSOR
}
}
node {
input: "X"
input: "scales"
output: "Y"
op_type: "Resize"
attribute {
name: "mode"
s: "linear"
type: STRING
}
}
name: "test-model"
input {
name: "X"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 4
}
dim {
dim_value: 4
}
}
}
}
}
}
opset_import {
domain: ""
version: 10
}

View File

@ -0,0 +1,82 @@
ir_version: 7
producer_name: "onnx-importer-test"
graph {
node {
output: "scales"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 4
data_type: 1
float_data: 1.0
float_data: 1.0
float_data: 2.0
float_data: 3.0
name: "const_tensor"
}
type: TENSOR
}
}
node {
input: "X"
input: "scales"
output: "Y"
op_type: "Resize"
attribute {
name: "mode"
s: "nearest"
type: STRING
}
}
name: "test-model"
input {
name: "X"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 4
}
dim {
dim_value: 6
}
}
}
}
}
}
opset_import {
domain: ""
version: 10
}

View File

@ -1063,7 +1063,7 @@ NGRAPH_TEST(${BACKEND_NAME}, onnx_model_reduce_sum_square)
test_case.run();
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_resize_opset10_import_only)
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_resize10_import_only)
{
const auto resize_fn = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/resize_opset10.prototxt"));
@ -1078,6 +1078,75 @@ NGRAPH_TEST(${BACKEND_NAME}, onnx_model_resize_opset10_import_only)
EXPECT_EQ(count_ops_of_type<onnx_import::default_opset::Constant>(resize_fn), 1);
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_resize10_down_scales_const_linear)
{
const auto function = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/resize10_down_scales_const_linear.prototxt"));
// Input data shape (1, 1, 2, 4)
// Input const scales values {1.0, 1.0, 0.6, 0.6}
// mode: nearest
Shape expected_output_shape{1, 1, 1, 2};
auto test_case = test::TestCase<TestEngine>(function);
test_case.add_input<float>({1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0});
test_case.add_expected_output<float>(expected_output_shape, {1.0, 2.66666651});
test_case.run();
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_resize10_down_scales_const_nearest)
{
const auto function = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/resize10_down_scales_const_nearest.prototxt"));
// Input data shape (1, 1, 2, 4)
// Input const scales values {1.0, 1.0, 0.6, 0.6}
// mode: linear
Shape expected_output_shape{1, 1, 1, 2};
auto test_case = test::TestCase<TestEngine>(function);
test_case.add_input<float>({1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0});
test_case.add_expected_output<float>(expected_output_shape, {1.0, 3.0});
test_case.run();
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_resize10_up_scales_const_linear)
{
const auto function = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/resize10_up_scales_const_linear.prototxt"));
// Input data shape (1, 1, 2, 2)
// Input const scales values {1.0, 1.0, 2.0, 2.0}
// mode: nearest
Shape expected_output_shape{1, 1, 4, 4};
auto test_case = test::TestCase<TestEngine>(function);
test_case.add_input<float>({1.0, 2.0, 3.0, 4.0});
test_case.add_expected_output<float>(
expected_output_shape,
{1.0, 1.5, 2.0, 2.0, 2.0, 2.5, 3.0, 3.0, 3.0, 3.5, 4.0, 4.0, 3.0, 3.5, 4.0, 4.0});
test_case.run();
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_resize10_up_scales_const_nearest)
{
const auto function = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/resize10_up_scales_const_nearest.prototxt"));
// Input data shape (1, 1, 2, 2)
// Input const scales values {1.0, 1.0, 2.0, 3.0}
// mode: linear
Shape expected_output_shape{1, 1, 4, 6};
auto test_case = test::TestCase<TestEngine>(function);
test_case.add_input<float>({1.0, 2.0, 3.0, 4.0});
test_case.add_expected_output<float>(
expected_output_shape, {1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0,
3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0});
test_case.run();
}
NGRAPH_TEST(${BACKEND_NAME}, onnx_model_shape)
{
auto function =

View File

@ -1345,6 +1345,9 @@ IE_CPU.onnx_dyn_shapes_model_flatten
IE_CPU.onnx_dyn_shapes_slice_10_default_axes
IE_CPU.fused_clamp_float
# Result mismatch 2.666666507720947266 is not close to 3 at index 1
IE_CPU.onnx_resize10_down_scales_const_linear
# GRUCell operation has a form that is not supported
IE_CPU.onnx_model_gru_defaults_fwd
IE_CPU.onnx_model_gru_fwd_activations

View File

@ -10,6 +10,17 @@ INTERPRETER.onnx_top_k_opset_10
reduce_sum_large_1d_to_scalar
reduce_sum_keep_large_1d_to_scalar
# "Unsupported op 'Interpolate'
INTERPRETER.onnx_resize10_down_scales_const_linear
INTERPRETER.onnx_resize10_down_scales_const_nearest
INTERPRETER.onnx_resize10_up_scales_const_linear
INTERPRETER.onnx_resize10_up_scales_const_nearest
INTERPRETER.onnx_upsample8_nearest_infer
INTERPRETER.onnx_upsample8_linear_infer
INTERPRETER.onnx_upsample9_scales_const_nearest_infer
INTERPRETER.onnx_upsample9_scales_const_linear_infer
INTERPRETER.onnx_upsample9_scales_input_nearest_infer
# ONNX Loop
onnx_controlflow_loop_2d_add_execution
@ -58,12 +69,6 @@ INTERPRETER.fused_clamp_bfloat16
INTERPRETER.auto_bcast_binary_elementwise
INTERPRETER.auto_bcast_binary_elementwise_pdpd
# Unsupported op 'Interpolate'
INTERPRETER.onnx_upsample8_nearest_infer
INTERPRETER.onnx_upsample8_linear_infer
INTERPRETER.onnx_upsample9_scales_const_nearest_infer
INTERPRETER.onnx_upsample9_scales_const_linear_infer
INTERPRETER.onnx_upsample9_scales_input_nearest_infer
# Backward conv
INTERPRETER.convolution_2d_1item
INTERPRETER.convolution_2d_1item_padded_1_1x1_1