Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
ec86e1a8
Unverified
Commit
ec86e1a8
authored
Jan 16, 2019
by
Adam Procter
Committed by
GitHub
Jan 16, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2312 from NervanaSystems/mkarzyns/backend_tests
[ONNX] Parametrize tests to run on multiple backends
parents
4dd9e110
2b4a5c4c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
143 additions
and
139 deletions
+143
-139
CMakeLists.txt
test/CMakeLists.txt
+9
-7
onnx_import.in.cpp
test/onnx_import.in.cpp
+134
-132
No files found.
test/CMakeLists.txt
View file @
ec86e1a8
...
...
@@ -65,13 +65,6 @@ set(SRC
set_source_files_properties
(
includes.cpp PROPERTIES COMPILE_DEFINITIONS
NGRAPH_INCLUDES=
"
${
PROJECT_SOURCE_DIR
}
/src/ngraph"
)
if
(
NGRAPH_ONNX_IMPORT_ENABLE
)
list
(
APPEND SRC onnx_import.cpp
)
if
(
NGRAPH_ONNXIFI_ENABLE
)
list
(
APPEND SRC onnxifi.cpp onnxifi_span.cpp
)
endif
()
endif
()
if
(
NGRAPH_INTERPRETER_ENABLE
)
list
(
APPEND SRC
backend_debug_api.cpp
...
...
@@ -140,13 +133,22 @@ set(MULTI_TEST_SRC
backend_unary_elementwise.in.cpp
convolution_test.in.cpp
)
if
(
NGRAPH_DISTRIBUTED_ENABLE
)
list
(
APPEND MULTI_TEST_SRC distributed.in.cpp
)
endif
()
if
(
NGRAPH_CPU_ENABLE
)
list
(
APPEND MULTI_TEST_SRC backend_graph_comparison.in.cpp
)
endif
()
if
(
NGRAPH_ONNX_IMPORT_ENABLE
)
list
(
APPEND MULTI_TEST_SRC onnx_import.in.cpp
)
if
(
NGRAPH_ONNXIFI_ENABLE
)
list
(
APPEND SRC onnxifi.cpp onnxifi_span.cpp
)
endif
()
endif
()
foreach
(
BACKEND_NAME
${
ACTIVE_BACKEND_LIST
}
)
# Some---but not all---autodiff tests go through multiple iterations with
# different random seeds. On the CPU backend this is currently very slow
...
...
test/onnx_import.cpp
→
test/onnx_import.
in.
cpp
View file @
ec86e1a8
...
...
@@ -32,10 +32,12 @@
using
namespace
ngraph
;
static
std
::
string
s_manifest
=
"${MANIFEST}"
;
using
Inputs
=
std
::
vector
<
std
::
vector
<
float
>>
;
using
Outputs
=
std
::
vector
<
std
::
vector
<
float
>>
;
TEST
(
onnx
,
model_output_names_check
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_output_names_check
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/split_equal_parts_default.onnx"
));
...
...
@@ -48,7 +50,7 @@ TEST(onnx, model_output_names_check)
}
}
TEST
(
onnx
,
model_add_abc
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_add_abc
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/add_abc.onnx"
));
...
...
@@ -56,11 +58,11 @@ TEST(onnx, model_add_abc)
Inputs
inputs
{{
1
},
{
2
},
{
3
}};
Outputs
expected_outputs
{{
6
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_add_abc_initializers
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_add_abc_initializers
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/add_abc_initializers.onnx"
));
...
...
@@ -68,11 +70,11 @@ TEST(onnx, model_add_abc_initializers)
Inputs
inputs
{{
1
,
2
,
3
,
4
}};
Outputs
expected_outputs
{{
3
,
6
,
9
,
12
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_addmul_abc
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_addmul_abc
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/addmul_abc.onnx"
));
...
...
@@ -86,11 +88,11 @@ TEST(onnx, model_addmul_abc)
auto
expected_output
=
test
::
NDArray
<
float
,
3
>
({{{
46
,
62
}},
{{
80
,
100
}}}).
get_vector
();
auto
result_vectors
=
execute
(
function
,
inputs
,
"
INTERPRETER
"
);
auto
result_vectors
=
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
);
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
,
result_vectors
.
front
()));
}
TEST
(
onnx
,
model_argmin_no_keepdims
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_argmin_no_keepdims
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/argmin_no_keepdims.onnx"
));
...
...
@@ -98,11 +100,11 @@ TEST(onnx, model_argmin_no_keepdims)
Inputs
inputs
{
test
::
NDArray
<
float
,
2
>
{{
2
,
1
},
{
3
,
10
}}.
get_vector
()};
std
::
vector
<
std
::
vector
<
int64_t
>>
expected_output
{{
1
,
0
}};
std
::
vector
<
std
::
vector
<
int64_t
>>
result
{
execute
<
float
,
int64_t
>
(
function
,
inputs
,
"
INTERPRETER
"
)};
execute
<
float
,
int64_t
>
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_EQ
(
expected_output
,
result
);
}
TEST
(
onnx
,
model_split_equal_parts_default
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_split_equal_parts_default
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/split_equal_parts_default.onnx"
));
...
...
@@ -110,7 +112,7 @@ TEST(onnx, model_split_equal_parts_default)
Inputs
inputs
{{
1
,
2
,
3
,
4
,
5
,
6
}};
Outputs
expected_outputs
{{
1
,
2
},
{
3
,
4
},
{
5
,
6
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_EQ
(
outputs
.
size
(),
expected_outputs
.
size
());
for
(
std
::
size_t
i
=
0
;
i
<
expected_outputs
.
size
();
++
i
)
...
...
@@ -120,7 +122,7 @@ TEST(onnx, model_split_equal_parts_default)
}
}
TEST
(
onnx
,
model_split_equal_parts_2d
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_split_equal_parts_2d
)
{
// Split into 2 equal parts along axis=1
auto
function
=
onnx_import
::
import_onnx_model
(
...
...
@@ -129,7 +131,7 @@ TEST(onnx, model_split_equal_parts_2d)
Inputs
inputs
{{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
}};
Outputs
expected_outputs
{{
0
,
1
,
2
,
6
,
7
,
8
},
{
3
,
4
,
5
,
9
,
10
,
11
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_EQ
(
outputs
.
size
(),
expected_outputs
.
size
());
for
(
std
::
size_t
i
=
0
;
i
<
expected_outputs
.
size
();
++
i
)
...
...
@@ -139,7 +141,7 @@ TEST(onnx, model_split_equal_parts_2d)
}
}
TEST
(
onnx
,
model_split_variable_parts_2d
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_split_variable_parts_2d
)
{
// Split into variable parts {2, 4} along axis=1
auto
function
=
onnx_import
::
import_onnx_model
(
...
...
@@ -148,7 +150,7 @@ TEST(onnx, model_split_variable_parts_2d)
Inputs
inputs
{{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
}};
Outputs
expected_outputs
{{
0
,
1
,
6
,
7
},
{
2
,
3
,
4
,
5
,
8
,
9
,
10
,
11
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_EQ
(
outputs
.
size
(),
expected_outputs
.
size
());
for
(
std
::
size_t
i
=
0
;
i
<
expected_outputs
.
size
();
++
i
)
...
...
@@ -179,12 +181,12 @@ namespace
test
::
NDArray
<
float
,
4
>
{{{{{
1.
f
,
1.
f
,
1.
f
},
{
1.
f
,
1.
f
,
1.
f
},
{
1.
f
,
1.
f
,
1.
f
}}}}}
.
get_vector
());
return
execute
(
function
,
args
,
"
INTERPRETER
"
);
return
execute
(
function
,
args
,
"
${BACKEND_NAME}
"
);
}
}
// namespace
TEST
(
onnx
,
model_conv2d_strides_padding
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_conv2d_strides_padding
)
{
// Convolution with strides=2 and padding=1
auto
function
=
onnx_import
::
import_onnx_model
(
...
...
@@ -201,7 +203,7 @@ TEST(onnx, model_conv2d_strides_padding)
EXPECT_EQ
(
expected_output
,
result
.
front
());
}
TEST
(
onnx
,
model_conv2d_strides_no_padding
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_conv2d_strides_no_padding
)
{
// Convolution with strides=2 and padding=1
auto
function
=
onnx_import
::
import_onnx_model
(
...
...
@@ -215,7 +217,7 @@ TEST(onnx, model_conv2d_strides_no_padding)
EXPECT_EQ
(
expected_output
,
result
.
front
());
}
TEST
(
onnx
,
model_conv2d_strides_assymetric_padding
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_conv2d_strides_assymetric_padding
)
{
// Convolution with strides=2 and padding=1
auto
function
=
onnx_import
::
import_onnx_model
(
...
...
@@ -230,7 +232,7 @@ TEST(onnx, model_conv2d_strides_assymetric_padding)
EXPECT_EQ
(
expected_output
,
result
.
front
());
}
TEST
(
onnx
,
model_average_pool_2d
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_average_pool_2d
)
{
// Pooling with strides=2 and no padding
auto
function
=
onnx_import
::
import_onnx_model
(
...
...
@@ -247,12 +249,12 @@ TEST(onnx, model_average_pool_2d)
// (1, 1, 2, 2)
auto
expected_output
=
test
::
NDArray
<
float
,
4
>
({{{{
2.5
f
,
4.5
f
},
{
10.5
f
,
12.5
f
}}}}).
get_vector
();
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_EQ
(
expected_output
,
outputs
.
front
());
}
TEST
(
onnx
,
model_average_pool_2d_pads
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_average_pool_2d_pads
)
{
// Pooling with strides=2 and padding=1
auto
function
=
onnx_import
::
import_onnx_model
(
...
...
@@ -271,12 +273,12 @@ TEST(onnx, model_average_pool_2d_pads)
test
::
NDArray
<
float
,
4
>
({{{{
0.
f
,
1.5
f
,
3.
f
},
{
6.
f
,
7.5
f
,
9.
f
},
{
12.
f
,
13.5
f
,
15.
f
}}}})
.
get_vector
();
Outputs
outputs
=
execute
(
function
,
inputs
,
"
INTERPRETER
"
);
Outputs
outputs
=
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
);
EXPECT_EQ
(
expected_output
,
outputs
.
front
());
}
TEST
(
onnx
,
model_max_pool_2d_pads
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_max_pool_2d_pads
)
{
// Pooling with strides=2 and padding=1
auto
function
=
onnx_import
::
import_onnx_model
(
...
...
@@ -295,12 +297,12 @@ TEST(onnx, model_max_pool_2d_pads)
test
::
NDArray
<
float
,
4
>
({{{{
0.
f
,
2.
f
,
3.
f
},
{
8.
f
,
10.
f
,
11.
f
},
{
12.
f
,
14.
f
,
15.
f
}}}})
.
get_vector
();
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_EQ
(
expected_output
,
outputs
.
front
());
}
TEST
(
onnx
,
model_batchnorm_default
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_batchnorm_default
)
{
// Batch Normalization with default parameters
auto
function
=
onnx_import
::
import_onnx_model
(
...
...
@@ -326,11 +328,11 @@ TEST(onnx, model_batchnorm_default)
{{{{
-
0.999995
f
,
0.
f
,
0.999995
f
}},
{{
-
0.22474074
f
,
1.
f
,
2.2247407
f
}}}}}
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_relu
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_relu
)
{
// Simple ReLU test
auto
function
=
...
...
@@ -339,11 +341,11 @@ TEST(onnx, model_relu)
Inputs
inputs
{{
-
1
,
-
2
,
0
,
1
,
2
,
3
}};
Outputs
expected_outputs
{{
0
,
0
,
0
,
1
,
2
,
3
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_sum
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_sum
)
{
// Simple Sum test
auto
function
=
...
...
@@ -356,11 +358,11 @@ TEST(onnx, model_sum)
inputs
.
emplace_back
(
std
::
vector
<
float
>
{
2.
f
,
6.
f
,
6.
f
});
Outputs
expected_outputs
{{
6.
f
,
9.
f
,
12.
f
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_sum_one_input
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_sum_one_input
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/sum_one_input.onnx"
));
...
...
@@ -368,11 +370,11 @@ TEST(onnx, model_sum_one_input)
// input data shape (3, )
Inputs
inputs
{{
3.
f
,
0.
f
,
2.
f
}};
Outputs
expected_outputs
{{
3.
f
,
0.
f
,
2.
f
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_min_two_inputs
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_min_two_inputs
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/min_two_inputs.onnx"
));
...
...
@@ -383,11 +385,11 @@ TEST(onnx, model_min_two_inputs)
inputs
.
emplace_back
(
std
::
vector
<
float
>
{
1.
f
,
4.
f
,
4.
f
});
Outputs
expected_outputs
{{
1.
f
,
2.
f
,
1.
f
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_max
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_max
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/max.onnx"
));
...
...
@@ -399,11 +401,11 @@ TEST(onnx, model_max)
inputs
.
emplace_back
(
std
::
vector
<
float
>
{
2.
f
,
5.
f
,
3.
f
});
Outputs
expected_outputs
{{
3.
f
,
5.
f
,
4.
f
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_mean
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_mean
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/mean.onnx"
));
...
...
@@ -415,11 +417,11 @@ TEST(onnx, model_mean)
inputs
.
emplace_back
(
std
::
vector
<
float
>
{
2.
f
,
6.
f
,
6.
f
});
Outputs
expected_outputs
{{
2.
f
,
3.
f
,
4.
f
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_gemm_abc
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_gemm_abc
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/gemm_abc.onnx"
));
...
...
@@ -445,11 +447,11 @@ TEST(onnx, model_gemm_abc)
{{
340
,
350.5
,
361
,
371.5
},
{
862
,
890.5
,
919
,
947.5
},
{
1384
,
1430.5
,
1477
,
1523.5
}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_matmul
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_matmul
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/matmul.onnx"
));
...
...
@@ -466,11 +468,11 @@ TEST(onnx, model_matmul)
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
2
>
({{
190
,
200
,
210
},
{
470
,
496
,
522
},
{
750
,
792
,
834
}}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_softmax
)
TEST
(
onnx
_
$
{
BACKEND_NAME
},
DISABLED_
model_softmax
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/softmax.onnx"
));
...
...
@@ -521,11 +523,11 @@ TEST(onnx, model_softmax)
6.32120559e-01
f
}}})
.
get_vector
();
auto
result_vectors
=
execute
(
function
,
inputs
,
"
INTERPRETER
"
);
auto
result_vectors
=
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
);
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
,
result_vectors
.
front
()));
}
TEST
(
onnx
,
model_concat
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_concat
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/concat.onnx"
));
...
...
@@ -537,11 +539,11 @@ TEST(onnx, model_concat)
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
1
>
({
1
,
2
,
3
,
4
}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_flatten
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_flatten
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/flatten.onnx"
));
...
...
@@ -553,11 +555,11 @@ TEST(onnx, model_flatten)
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
3
>
({{{
1
,
2
,
3
,
4
},
{
5
,
6
,
7
,
8
}}}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_sub
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_sub
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/sub.onnx"
));
...
...
@@ -569,11 +571,11 @@ TEST(onnx, model_sub)
auto
expected_output
=
test
::
NDArray
<
float
,
3
>
({{{
-
3
,
-
3
,
-
4
}}}).
get_vector
();
auto
result_vectors
=
execute
(
function
,
inputs
,
"
INTERPRETER
"
);
auto
result_vectors
=
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
);
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
,
result_vectors
.
front
()));
}
TEST
(
onnx
,
model_unsqueeze
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_unsqueeze
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/unsqueeze.onnx"
));
...
...
@@ -592,11 +594,11 @@ TEST(onnx, model_unsqueeze)
{{
1
,
1
,
1
,
1
,
1
},
{
1
,
1
,
1
,
1
,
1
},
{
1
,
1
,
1
,
1
,
1
},
{
1
,
1
,
1
,
1
,
1
}}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_squeeze
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_squeeze
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/squeeze_duplicate_axes.onnx"
));
...
...
@@ -611,11 +613,11 @@ TEST(onnx, model_squeeze)
test
::
NDArray
<
float
,
2
>
({{
1.0
f
,
2.0
f
},
{
3.0
f
,
4.0
f
},
{
5.0
f
,
6.0
f
},
{
7.0
f
,
8.0
f
}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_div
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_div
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/div.onnx"
));
...
...
@@ -627,11 +629,11 @@ TEST(onnx, model_div)
auto
expected_output
=
test
::
NDArray
<
float
,
3
>
({{{
1
,
0.5
,
0.25
}}}).
get_vector
();
auto
result_vectors
=
execute
(
function
,
inputs
,
"
INTERPRETER
"
);
auto
result_vectors
=
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
);
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
,
result_vectors
.
front
()));
}
TEST
(
onnx
,
model_add_bcast
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_add_bcast
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/add_bcast.onnx"
));
...
...
@@ -652,11 +654,11 @@ TEST(onnx, model_add_bcast)
{{
2
,
3
,
4
,
5
,
6
},
{
2
,
3
,
4
,
5
,
6
},
{
2
,
3
,
4
,
5
,
6
},
{
2
,
3
,
4
,
5
,
6
}}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reshape_reduced_dims
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reshape_reduced_dims
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reshape_reduced_dims.onnx"
));
...
...
@@ -672,11 +674,11 @@ TEST(onnx, model_reshape_reduced_dims)
{
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reshape_reordered_dims
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reshape_reordered_dims
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reshape_reordered_dims.onnx"
));
...
...
@@ -693,11 +695,11 @@ TEST(onnx, model_reshape_reordered_dims)
{{
18
,
19
,
20
},
{
21
,
22
,
23
}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reshape_extended_dims
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reshape_extended_dims
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reshape_extended_dims.onnx"
));
...
...
@@ -713,11 +715,11 @@ TEST(onnx, model_reshape_extended_dims)
{{{
16
,
17
},
{
18
,
19
}},
{{
20
,
21
},
{
22
,
23
}}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reshape_single_dim
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reshape_single_dim
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reshape_single_dim.onnx"
));
...
...
@@ -733,11 +735,11 @@ TEST(onnx, model_reshape_single_dim)
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reshape_negative_dim
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reshape_negative_dim
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reshape_negative_dim.onnx"
));
...
...
@@ -756,11 +758,11 @@ TEST(onnx, model_reshape_negative_dim)
{{
20
,
21
},
{
22
,
23
}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reshape_negative_with_zero_dim
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reshape_negative_with_zero_dim
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reshape_negative_with_zero_dims.onnx"
));
...
...
@@ -776,11 +778,11 @@ TEST(onnx, model_reshape_negative_with_zero_dim)
{{
12
,
13
},
{
14
,
15
},
{
16
,
17
},
{
18
,
19
},
{
20
,
21
},
{
22
,
23
}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reshape_output_shape_as_input
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reshape_output_shape_as_input
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reshape_output_shape_as_input.onnx"
));
...
...
@@ -796,11 +798,11 @@ TEST(onnx, model_reshape_output_shape_as_input)
{{
12
,
13
},
{
14
,
15
},
{
16
,
17
},
{
18
,
19
},
{
20
,
21
},
{
22
,
23
}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reduce_log_sum
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reduce_log_sum
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reduce_log_sum.onnx"
));
...
...
@@ -813,11 +815,11 @@ TEST(onnx, model_reduce_log_sum)
// output data shape (1,)
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
4
>
({{{{
2.77258872
f
}}}}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reduce_log_sum_exp
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reduce_log_sum_exp
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reduce_log_sum_exp.onnx"
));
...
...
@@ -830,11 +832,11 @@ TEST(onnx, model_reduce_log_sum_exp)
// output data shape (1,)
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
4
>
({{{{
3.77258872
f
}}}}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reduce_l1
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reduce_l1
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reduce_l1.onnx"
));
...
...
@@ -847,11 +849,11 @@ TEST(onnx, model_reduce_l1)
// output data shape (1,)
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
4
>
({{{{
16
}}}}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reduce_l2
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reduce_l2
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reduce_l2.onnx"
));
...
...
@@ -864,11 +866,11 @@ TEST(onnx, model_reduce_l2)
// output data shape (1,)
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
4
>
({{{{
4
}}}}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reduce_max
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reduce_max
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reduce_max.onnx"
));
...
...
@@ -881,11 +883,11 @@ TEST(onnx, model_reduce_max)
// output data shape (1,)
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
4
>
({{{{
16
}}}}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reduce_mean
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reduce_mean
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reduce_mean.onnx"
));
...
...
@@ -898,11 +900,11 @@ TEST(onnx, model_reduce_mean)
// output data shape (1,)
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
4
>
({{{{
1
}}}}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reduce_min
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reduce_min
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reduce_min.onnx"
));
...
...
@@ -915,11 +917,11 @@ TEST(onnx, model_reduce_min)
// output data shape (1,)
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
4
>
({{{{
1
}}}}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reduce_prod
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reduce_prod
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reduce_prod.onnx"
));
...
...
@@ -932,11 +934,11 @@ TEST(onnx, model_reduce_prod)
// output data shape (1,)
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
4
>
({{{{
1
}}}}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reduce_sum
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reduce_sum
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reduce_sum.onnx"
));
...
...
@@ -949,11 +951,11 @@ TEST(onnx, model_reduce_sum)
// output data shape (1,)
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
4
>
({{{{
16
}}}}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_reduce_sum_square
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_reduce_sum_square
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/reduce_sum_square.onnx"
));
...
...
@@ -966,11 +968,11 @@ TEST(onnx, model_reduce_sum_square)
// output data shape (1,)
Outputs
expected_outputs
{
test
::
NDArray
<
float
,
4
>
({{{{
16
}}}}).
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_shape
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_shape
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/shape.onnx"
));
...
...
@@ -985,11 +987,11 @@ TEST(onnx, model_shape)
std
::
vector
<
std
::
vector
<
int64_t
>>
expected_output
{{
3
,
4
,
5
}};
std
::
vector
<
std
::
vector
<
int64_t
>>
outputs
=
execute
<
float
,
int64_t
>
(
function
,
inputs
,
"
INTERPRETER
"
);
execute
<
float
,
int64_t
>
(
function
,
inputs
,
"
${BACKEND_NAME}
"
);
EXPECT_TRUE
(
test
::
all_close
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_elu
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_elu
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/elu.onnx"
));
...
...
@@ -1032,11 +1034,11 @@ TEST(onnx, model_elu)
{
2
,
2
,
2
,
2
,
2
}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_leaky_relu
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_leaky_relu
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/leaky_relu.onnx"
));
...
...
@@ -1063,11 +1065,11 @@ TEST(onnx, model_leaky_relu)
{
2
,
2
,
2
,
2
,
2
}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
prelu
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
prelu
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/prelu.onnx"
));
...
...
@@ -1093,11 +1095,11 @@ TEST(onnx, prelu)
{{
1
,
1
,
1
,
1
,
1
},
{
0
,
-
1
,
0
,
-
1
,
0
},
{
0
,
0
,
0
,
0
,
0
},
{
2
,
2
,
2
,
2
,
2
}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_selu
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_selu
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/selu.onnx"
));
...
...
@@ -1134,11 +1136,11 @@ TEST(onnx, model_selu)
{
6
,
6
,
6
,
6
,
6
}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_sigmoid
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_sigmoid
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/sigmoid.onnx"
));
...
...
@@ -1209,11 +1211,11 @@ TEST(onnx, model_sigmoid)
0.880797077977882
f
}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_tanh
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_tanh
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/tanh.onnx"
));
...
...
@@ -1284,11 +1286,11 @@ TEST(onnx, model_tanh)
0.964027580075817
f
}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_thresholded_relu
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_thresholded_relu
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/thresholded_relu.onnx"
));
...
...
@@ -1308,11 +1310,11 @@ TEST(onnx, model_thresholded_relu)
{{
0
,
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_unsupported_op
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_unsupported_op
)
{
try
{
...
...
@@ -1333,7 +1335,7 @@ TEST(onnx, model_unsupported_op)
}
}
TEST
(
onnx
,
model_custom_op
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_custom_op
)
{
onnx_import
::
register_operator
(
"AddQ"
,
1
,
"com.intel.ai"
,
[](
const
onnx_import
::
Node
&
node
)
->
NodeVector
{
...
...
@@ -1347,11 +1349,11 @@ TEST(onnx, model_custom_op)
Inputs
inputs
{{
1
,
2
,
3
,
4
}};
Outputs
expected_outputs
{{
3
,
6
,
9
,
12
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_custom_op_default_domain
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_custom_op_default_domain
)
{
onnx_import
::
register_operator
(
"AddQ"
,
1
,
"com.intel.ai"
,
[](
const
onnx_import
::
Node
&
node
)
->
NodeVector
{
...
...
@@ -1365,11 +1367,11 @@ TEST(onnx, model_custom_op_default_domain)
Inputs
inputs
{{
1
,
2
,
3
,
4
}};
Outputs
expected_outputs
{{
3
,
6
,
9
,
12
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_outputs
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_conv2d_dilation_assymetric_pads_strides
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_conv2d_dilation_assymetric_pads_strides
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/conv2d_dilation_assym_pads_strides.onnx"
));
...
...
@@ -1405,11 +1407,11 @@ TEST(onnx, model_conv2d_dilation_assymetric_pads_strides)
{{
-
0.10154513269662857
f
,
-
0.13448859751224518
f
}}}})
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_conv3d_bias
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_conv3d_bias
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/conv3d_bias.onnx"
));
...
...
@@ -1519,11 +1521,11 @@ TEST(onnx, model_conv3d_bias)
-
0.39770257472991943
f
,
-
0.45317384600639343
f
,
-
0.5598302483558655
f
,
-
0.2542789578437805
f
,
-
0.5359901785850525
f
,
-
0.48090484738349915
f
,
-
0.38603779673576355
f
,
-
0.4991581439971924
f
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_matmul_vec_ten3d
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_matmul_vec_ten3d
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/matmul_vec_ten3d.onnx"
));
...
...
@@ -1535,11 +1537,11 @@ TEST(onnx, model_matmul_vec_ten3d)
Outputs
expected_output
{
test
::
NDArray
<
float
,
2
>
{{
1.
f
},
{
3.
f
},
{
5.
f
}}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_softplus
)
TEST
(
onnx
_
$
{
BACKEND_NAME
},
DISABLED_
model_softplus
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/softplus.onnx"
));
...
...
@@ -1578,7 +1580,7 @@ TEST(onnx, model_softplus)
std
::
transform
(
std
::
begin
(
input
),
std
::
end
(
input
),
std
::
back_inserter
(
output
),
softplus_impl
);
Outputs
expected_output
{
output
};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
inputs
.
clear
();
...
...
@@ -1599,7 +1601,7 @@ TEST(onnx, model_softplus)
std
::
numeric_limits
<
float
>::
infinity
(),
std
::
numeric_limits
<
float
>::
infinity
()});
input
=
inputs
.
back
();
outputs
=
execute
(
function
,
inputs
,
"
INTERPRETER
"
);
outputs
=
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
);
for
(
float
v
:
outputs
.
front
())
{
...
...
@@ -1607,7 +1609,7 @@ TEST(onnx, model_softplus)
}
}
TEST
(
onnx
,
model_sum_opset8
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_sum_opset8
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/sum_opset8.onnx"
));
...
...
@@ -1625,11 +1627,11 @@ TEST(onnx, model_sum_opset8)
{{
311.0
f
,
312.0
f
,
313.0
f
},
{
321.0
f
,
322.0
f
,
323.0
f
},
{
331.0
f
,
332.0
f
,
333.0
f
}}}
.
get_vector
()};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_conv_transpose_w_groups
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_conv_transpose_w_groups
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/conv_transpose_w_groups.onnx"
));
...
...
@@ -1644,11 +1646,11 @@ TEST(onnx, model_conv_transpose_w_groups)
Outputs
expected_output
{
std
::
vector
<
float
>
{
28.
f
,
34.
f
,
252.
f
,
274.
f
,
732.
f
,
770.
f
,
1468.
f
,
1522.
f
}};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
INTERPRETER
"
)};
Outputs
outputs
{
execute
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close_f
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_argmax_int32
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_argmax_int32
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/argmax_int32.onnx"
));
...
...
@@ -1660,11 +1662,11 @@ TEST(onnx, model_argmax_int32)
std
::
vector
<
std
::
int64_t
>
{
1
,
1
,
1
,
1
,
1
,
1
}};
std
::
vector
<
std
::
vector
<
std
::
int64_t
>>
outputs
{
execute
<
std
::
int32_t
,
std
::
int64_t
>
(
function
,
inputs
,
"
INTERPRETER
"
)};
execute
<
std
::
int32_t
,
std
::
int64_t
>
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_argmin_int32
)
TEST
(
onnx
_
$
{
BACKEND_NAME
}
,
model_argmin_int32
)
{
auto
function
=
onnx_import
::
import_onnx_model
(
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/argmin_int32.onnx"
));
...
...
@@ -1675,11 +1677,11 @@ TEST(onnx, model_argmin_int32)
std
::
vector
<
std
::
vector
<
std
::
int64_t
>>
expected_output
{
std
::
vector
<
std
::
int64_t
>
{
0
,
0
,
0
,
0
}};
std
::
vector
<
std
::
vector
<
std
::
int64_t
>>
outputs
{
execute
<
std
::
int32_t
,
std
::
int64_t
>
(
function
,
inputs
,
"
INTERPRETER
"
)};
execute
<
std
::
int32_t
,
std
::
int64_t
>
(
function
,
inputs
,
"
${BACKEND_NAME}
"
)};
EXPECT_TRUE
(
test
::
all_close
(
expected_output
.
front
(),
outputs
.
front
()));
}
TEST
(
onnx
,
model_
is_op_supported
)
TEST
(
onnx
_
$
{
BACKEND_NAME
},
is_op_supported
)
{
// Simple case
EXPECT_TRUE
(
onnx_import
::
is_operator_supported
(
"Sum"
,
1
,
"ai.onnx"
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment