Commit 073e68fd authored by Adam Rogowiec's avatar Adam Rogowiec Committed by Robert Kimball

[ONNX] Convert models to text format. (#2528)

* Handle models in prototxt format.
Signed-off-by: 's avatarAdam Rogowiec <adam.rogowiec@intel.com>

* Convert Onnx models to text format.

* Tool for conversion between protobuf ONNX models in binary and text format.
Signed-off-by: 's avatarAdam Rogowiec <adam.rogowiec@intel.com>

* Update ONNX test models text format.

* Convert ONNX LSTM model to text format.

* Rename and make second argument optional.

* Unify models metadata.

* Remove onnx binary models.

* Review: fix comments.

* Fix not yet updated models extension in UTs.

* Add UT with binary protobuf models.

* Clang format.

* Remove failing UT in prototxt since it has problems with CI.

* Inhibit logging protobuf errors.

* Revert "Remove failing UT in prototxt since it has problems with CI."

This reverts commit 94741a8c4594f3cc2ebdca428fa40b94a79240c2.

* Remove LogSilencer from onnx importer api and remove respective UT.

* Conversion script updates
parent 89c00a2c
......@@ -15,6 +15,8 @@
//*****************************************************************************
#include <fstream>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/text_format.h>
#include <memory>
#include "core/graph.hpp"
......@@ -54,10 +56,20 @@ namespace ngraph
std::shared_ptr<Function> import_onnx_model(std::istream& sin, const Weights& weights)
{
onnx::ModelProto model_proto;
// Try parsing input as a binary protobuf message
if (!model_proto.ParseFromIstream(&sin))
{
throw detail::error::stream_parse{sin};
// Rewind to the beginning and clear stream state.
sin.clear();
sin.seekg(0);
google::protobuf::io::IstreamInputStream iistream(&sin);
// Try parsing input as a prototxt message
if (!google::protobuf::TextFormat::Parse(&iistream, &model_proto))
{
throw detail::error::stream_parse{sin};
}
}
Model model{model_proto};
Graph graph{model_proto.graph(), model, weights};
auto function = std::make_shared<Function>(
......
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
input: "B"
output: "X"
name: "add_node1"
op_type: "Add"
}
node {
input: "X"
input: "C"
output: "Y"
name: "add_node2"
op_type: "Add"
}
name: "test_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
}
}
}
}
input {
name: "B"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
}
}
}
}
input {
name: "C"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
}
}
}
}
}
opset_import {
version: 4
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
output: "B"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 2
dims: 2
data_type: 1
float_data: 1
float_data: 2
float_data: 3
float_data: 4
name: "const_tensor"
}
type: TENSOR
}
}
node {
input: "A"
input: "B"
output: "X"
name: "add_node1"
op_type: "Add"
}
node {
input: "X"
input: "C"
output: "Y"
name: "add_node2"
op_type: "Add"
}
name: "test_graph"
initializer {
dims: 2
dims: 2
data_type: 1
name: "A"
raw_data: "\000\000\200?\000\000\000@\000\000@@\000\000\200@"
}
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
input {
name: "C"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
version: 4
}
 backend-test:g

x
ysum"Addtest_add_bcastZ
x



Z
y

b
sum



B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "x"
input: "y"
output: "sum"
op_type: "Add"
}
name: "test_add_bcast"
input {
name: "x"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 4
}
dim {
dim_value: 5
}
}
}
}
}
input {
name: "y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 5
}
}
}
}
}
output {
name: "sum"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 4
}
dim {
dim_value: 5
}
}
}
}
}
}
opset_import {
version: 7
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
model_version: 1
graph {
node {
input: "Input4"
input: "Input5"
output: "ElementTimes6_Output_0"
name: "ElementTimes6"
op_type: "Mul"
attribute {
name: "broadcast"
i: 0
type: INT
}
doc_string: ""
domain: ""
}
node {
input: "Input3"
input: "ElementTimes6_Output_0"
output: "Plus9_Output_0"
name: "Plus9"
op_type: "Add"
attribute {
name: "broadcast"
i: 0
type: INT
}
doc_string: ""
domain: ""
}
name: "CNTKGraph"
input {
name: "Input4"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
input {
name: "Input5"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
input {
name: "Input3"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Plus9_Output_0"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
value_info {
name: "ElementTimes6_Output_0"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
domain: ""
version: 2
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "data"
output: "reduced"
name: "node1"
op_type: "ArgMax"
attribute {
name: "keepdims"
i: 1
type: INT
}
attribute {
name: "axis"
i: 1
type: INT
}
doc_string: "ArgMax"
domain: ""
}
name: "test"
input {
name: "data"
type {
tensor_type {
elem_type: 6
shape {
dim {
dim_value: 3
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "reduced"
type {
tensor_type {
elem_type: 7
shape {
dim {
dim_value: 3
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
version: 7
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "data"
output: "reduced"
name: "node1"
op_type: "ArgMin"
attribute {
name: "keepdims"
i: 0
type: INT
}
attribute {
name: "axis"
i: 0
type: INT
}
doc_string: "ArgMin"
domain: ""
}
name: "test"
input {
name: "data"
type {
tensor_type {
elem_type: 6
shape {
dim {
dim_value: 3
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "reduced"
type {
tensor_type {
elem_type: 7
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
version: 7
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "data"
output: "result"
op_type: "ArgMin"
attribute {
name: "axis"
i: 1
type: INT
}
attribute {
name: "keepdims"
i: 0
type: INT
}
}
name: "test_argmin_no_keepdims_example"
input {
name: "data"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "result"
type {
tensor_type {
elem_type: 7
shape {
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
version: 8
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "x"
output: "y"
op_type: "AveragePool"
attribute {
name: "kernel_shape"
ints: 2
ints: 2
type: INTS
}
attribute {
name: "strides"
ints: 2
ints: 2
type: INTS
}
}
name: "compute_graph"
input {
name: "x"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 4
}
dim {
dim_value: 4
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: 1
shape {
}
}
}
}
}
opset_import {
version: 7
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "x"
output: "y"
op_type: "AveragePool"
attribute {
name: "kernel_shape"
ints: 2
ints: 2
type: INTS
}
attribute {
name: "strides"
ints: 2
ints: 2
type: INTS
}
attribute {
name: "pads"
ints: 1
ints: 1
ints: 1
ints: 1
type: INTS
}
}
name: "compute_graph"
input {
name: "x"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 4
}
dim {
dim_value: 4
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: 1
shape {
}
}
}
}
}
opset_import {
version: 7
}
 backend-test:
.
x
s
bias
mean
vary"BatchNormalizationtest_batchnorm_exampleZ
x




Z
s

Z
bias

Z
mean

Z
var

b
y




B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "x"
input: "s"
input: "bias"
input: "mean"
input: "var"
output: "y"
op_type: "BatchNormalization"
}
name: "test_batchnorm_example"
input {
name: "x"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 3
}
}
}
}
}
input {
name: "s"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
}
}
}
}
input {
name: "bias"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
}
}
}
}
input {
name: "mean"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
}
}
}
}
input {
name: "var"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 3
}
}
}
}
}
}
opset_import {
version: 8
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "value0"
input: "value1"
output: "output"
op_type: "Concat"
attribute {
name: "axis"
i: 0
type: INT
}
}
name: "test_concat_1d_axis_0"
input {
name: "value0"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
}
}
}
}
input {
name: "value1"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
}
}
}
}
output {
name: "output"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 4
}
}
}
}
}
}
opset_import {
version: 7
}
ONNXNgraphImporter:
|
A
BC"Conv*
auto_pad*
dilations@@*
group*
kernel_shape@@*
pads@@@@*
strides@@ compute_graphZ
A




Z
B




b
C




B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
input: "B"
output: "C"
op_type: "Conv"
attribute {
name: "auto_pad"
type: FLOATS
}
attribute {
name: "dilations"
ints: 1
ints: 1
type: INTS
}
attribute {
name: "group"
i: 1
type: INT
}
attribute {
name: "kernel_shape"
ints: 3
ints: 3
type: INTS
}
attribute {
name: "pads"
ints: 1
ints: 1
ints: 1
ints: 2
type: INTS
}
attribute {
name: "strides"
ints: 3
ints: 1
type: INTS
}
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
}
}
}
}
input {
name: "B"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 3
}
dim {
dim_value: 3
}
}
}
}
}
output {
name: "C"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
version: 1
}
ONNXNgraphImporter:

A
B
CD"Conv*
auto_pad*
dilations@@@*
group*
kernel_shape@@@*
pads@@@@@@*
strides@@@ compute_graphZ
A





Z
B





Z
C

b
D





B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
input: "B"
input: "C"
output: "D"
op_type: "Conv"
attribute {
name: "auto_pad"
type: FLOATS
}
attribute {
name: "dilations"
ints: 2
ints: 2
ints: 2
type: INTS
}
attribute {
name: "group"
i: 1
type: INT
}
attribute {
name: "kernel_shape"
ints: 2
ints: 2
ints: 2
type: INTS
}
attribute {
name: "pads"
ints: 2
ints: 2
ints: 2
ints: 2
ints: 2
ints: 2
type: INTS
}
attribute {
name: "strides"
ints: 2
ints: 2
ints: 2
type: INTS
}
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 4
}
dim {
dim_value: 4
}
dim {
dim_value: 4
}
}
}
}
}
input {
name: "B"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
input {
name: "C"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
}
}
}
}
output {
name: "D"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
dim {
dim_value: 3
}
dim {
dim_value: 3
}
dim {
dim_value: 3
}
}
}
}
}
}
opset_import {
version: 1
}
ir_version: 4
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "X"
input: "W"
output: "Y"
name: "node1"
op_type: "ConvTranspose"
attribute {
name: "auto_pad"
s: "NOTSET"
type: STRING
}
attribute {
name: "kernel_shape"
ints: 1
ints: 1
type: INTS
}
attribute {
name: "pads"
ints: 0
ints: 0
ints: 0
ints: 0
type: INTS
}
attribute {
name: "strides"
ints: 1
ints: 1
type: INTS
}
attribute {
name: "group"
i: 4
type: INT
}
doc_string: "ConvTranspose"
domain: ""
}
name: "test"
input {
name: "X"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 16
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
}
}
}
}
input {
name: "W"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 16
}
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 8
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
}
}
}
}
}
opset_import {
version: 7
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "x"
input: "W"
output: "y"
op_type: "Conv"
attribute {
name: "kernel_shape"
ints: 3
ints: 3
type: INTS
}
attribute {
name: "pads"
ints: 1
ints: 0
ints: 1
ints: 0
type: INTS
}
attribute {
name: "strides"
ints: 2
ints: 2
type: INTS
}
}
name: "test_conv_with_strides_and_asymmetric_padding"
input {
name: "x"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 7
}
dim {
dim_value: 5
}
}
}
}
}
input {
name: "W"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 3
}
dim {
dim_value: 3
}
}
}
}
}
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: 2
}
}
}
}
}
}
opset_import {
version: 8
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "x"
input: "W"
output: "y"
op_type: "Conv"
attribute {
name: "kernel_shape"
ints: 3
ints: 3
type: INTS
}
attribute {
name: "pads"
ints: 0
ints: 0
ints: 0
ints: 0
type: INTS
}
attribute {
name: "strides"
ints: 2
ints: 2
type: INTS
}
}
name: "test_conv_with_strides_no_padding"
input {
name: "x"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 7
}
dim {
dim_value: 5
}
}
}
}
}
input {
name: "W"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 3
}
dim {
dim_value: 3
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 3
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
version: 8
}
 backend-test:
K
x
Wy"Conv*
kernel_shape@@*
pads@@@@*
strides@@test_conv_with_strides_paddingZ
x




Z
W




b
y




B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "x"
input: "W"
output: "y"
op_type: "Conv"
attribute {
name: "kernel_shape"
ints: 3
ints: 3
type: INTS
}
attribute {
name: "pads"
ints: 1
ints: 1
ints: 1
ints: 1
type: INTS
}
attribute {
name: "strides"
ints: 2
ints: 2
type: INTS
}
}
name: "test_conv_with_strides_padding"
input {
name: "x"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 7
}
dim {
dim_value: 5
}
}
}
}
}
input {
name: "W"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 3
}
dim {
dim_value: 3
}
}
}
}
}
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: 3
}
}
}
}
}
}
opset_import {
version: 8
}
ONNXNgraphImporter:
N
A
B
CD"Conv*
kernel_shape@@*
pads@@@@*
strides@@ compute_graphZ
A




Z
B




Z
C

b
D




B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
input: "B"
input: "C"
output: "D"
op_type: "Conv"
attribute {
name: "kernel_shape"
ints: 3
ints: 3
type: INTS
}
attribute {
name: "pads"
ints: 1
ints: 1
ints: 1
ints: 1
type: INTS
}
attribute {
name: "strides"
ints: 2
ints: 2
type: INTS
}
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 7
}
dim {
dim_value: 5
}
}
}
}
}
input {
name: "B"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 3
}
dim {
dim_value: 3
}
}
}
}
}
input {
name: "C"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
}
}
}
}
output {
name: "D"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 4
}
dim {
dim_value: 3
}
}
}
}
}
}
opset_import {
version: 1
}
ngraph ONNXImporter:D
xy"Cosh
cosh_graphZ
x


b
y


B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "x"
output: "y"
op_type: "Cosh"
}
name: "cosh_graph"
input {
name: "x"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 3
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 3
}
}
}
}
}
}
opset_import {
version: 9
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
output: "B"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 2
dims: 2
data_type: 1
float_data: 1
float_data: 2
float_data: 3
float_data: 4
name: "const_tensor"
}
type: TENSOR
}
}
node {
input: "A"
input: "B"
output: "X"
name: "add_node1"
op_type: "AddQ"
domain: "com.intel.ai"
}
node {
input: "X"
input: "C"
output: "Y"
name: "add_node2"
op_type: "Add"
}
name: "test_graph"
initializer {
dims: 2
dims: 2
data_type: 1
name: "A"
raw_data: "\000\000\200?\000\000\000@\000\000@@\000\000\200@"
}
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
input {
name: "C"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
domain: "com.intel.ai"
version: 1
}
opset_import {
domain: ""
version: 6
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
output: "B"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 2
dims: 2
data_type: 1
float_data: 1
float_data: 2
float_data: 3
float_data: 4
name: "const_tensor"
}
type: TENSOR
}
}
node {
input: "A"
input: "B"
output: "X"
name: "add_node1"
op_type: "AddQ"
domain: "com.intel.ai"
}
node {
input: "X"
input: "C"
output: "Y"
name: "add_node2"
op_type: "Add"
}
name: "test_graph"
initializer {
dims: 2
dims: 2
data_type: 1
name: "A"
raw_data: "\000\000\200?\000\000\000@\000\000@@\000\000\200@"
}
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
input {
name: "C"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
domain: "com.intel.ai"
version: 1
}
ONNXNgraphImporter:q
&
AB" DepthToSpace*
blocksize compute_graphZ
A




b
B




B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
output: "B"
op_type: "DepthToSpace"
attribute {
name: "blocksize"
i: 2
type: INT
}
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 4
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "B"
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 {
version: 1
}
ONNXNgraphImporter:q
&
AB" DepthToSpace*
blocksize compute_graphZ
A




b
B




B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
output: "B"
op_type: "DepthToSpace"
attribute {
name: "blocksize"
i: 3
type: INT
}
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 4
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "B"
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 {
version: 1
}
ONNXNgraphImporter:i
&
AB" DepthToSpace*
blocksize compute_graphZ
A



b
B



B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
output: "B"
op_type: "DepthToSpace"
attribute {
name: "blocksize"
i: 2
type: INT
}
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 4
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "B"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 4
}
dim {
dim_value: 4
}
}
}
}
}
}
opset_import {
version: 1
}
ONNXNgraphImporter:_

AB" DepthToSpace compute_graphZ
A




b
B




B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
output: "B"
op_type: "DepthToSpace"
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 4
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "B"
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 {
version: 1
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
model_version: 1
graph {
node {
input: "Input3"
input: "Input4"
output: "Block17_Output_0"
name: "Block17"
op_type: "Div"
attribute {
name: "broadcast"
i: 0
type: INT
}
doc_string: ""
domain: ""
}
name: "CNTKGraph"
input {
name: "Input3"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 3
}
}
}
}
}
input {
name: "Input4"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 3
}
}
}
}
}
output {
name: "Block17_Output_0"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 3
}
}
}
}
}
}
opset_import {
domain: ""
version: 2
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "x"
output: "y"
op_type: "Elu"
attribute {
name: "alpha"
f: 2
type: FLOAT
}
}
name: "test_elu"
input {
name: "x"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 4
}
dim {
dim_value: 5
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 4
}
dim {
dim_value: 5
}
}
}
}
}
}
opset_import {
version: 7
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "cond"
output: "cond_bool"
op_type: "Cast"
attribute {
name: "to"
i: 9
type: INT
}
}
node {
input: "cond_bool"
input: "x1"
input: "x2"
output: "y"
op_type: "Where"
}
name: "where_graph"
input {
name: "cond"
type {
tensor_type {
elem_type: INT32
shape {
dim {
dim_value: 3
}
dim {
dim_value: 3
}
dim {
dim_value: 3
}
}
}
}
}
input {
name: "x1"
type {
tensor_type {
elem_type: INT32
shape {
dim {
dim_value: 1
}
dim {
dim_value: 3
}
}
}
}
}
input {
name: "x2"
type {
tensor_type {
elem_type: INT32
shape {
dim {
dim_value: 3
}
dim {
dim_value: 1
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: INT32
shape {
dim {
dim_value: 3
}
dim {
dim_value: 3
}
dim {
dim_value: 3
}
}
}
}
}
}
opset_import {
version: 9
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
model_version: 1
graph {
node {
input: "Input3"
output: "Block87_Output_0"
name: "Block87"
op_type: "Flatten"
attribute {
name: "axis"
i: 1
type: INT
}
doc_string: ""
domain: ""
}
name: "CNTKGraph"
input {
name: "Input3"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Block87_Output_0"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 4
}
}
}
}
}
}
opset_import {
domain: ""
version: 2
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "a"
input: "b"
input: "c"
output: "y"
op_type: "Gemm"
attribute {
name: "alpha"
f: 0.5
type: FLOAT
}
attribute {
name: "beta"
f: 0.5
type: FLOAT
}
}
name: "test_gemm_nobroadcast"
input {
name: "a"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 6
}
}
}
}
}
input {
name: "b"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 6
}
dim {
dim_value: 4
}
}
}
}
}
input {
name: "c"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 4
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 4
}
}
}
}
}
}
opset_import {
version: 7
}
ir_version: 4
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
output: "B"
op_type: "GlobalLpPool"
attribute {
name: "p"
i: 0
type: INT
}
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 7
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 3
}
dim {
dim_value: 4
}
}
}
}
}
output {
name: "B"
type {
tensor_type {
elem_type: 7
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
}
}
}
}
}
opset_import {
version: 1
}
ONNXNgraphImporter:i

AB" GlobalLpPool*
p compute_graphZ
A




b
B




B
\ No newline at end of file
ir_version: 4
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
output: "B"
op_type: "GlobalLpPool"
attribute {
name: "p"
i: 1
type: INT
}
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 3
}
dim {
dim_value: 4
}
}
}
}
}
output {
name: "B"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
}
}
}
}
}
opset_import {
version: 1
}
ONNXNgraphImporter:i

AB" GlobalLpPool*
p compute_graphZ
A




b
B




B
\ No newline at end of file
ir_version: 4
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
output: "B"
op_type: "GlobalLpPool"
attribute {
name: "p"
i: 2
type: INT
}
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 3
}
dim {
dim_value: 4
}
}
}
}
}
output {
name: "B"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
}
}
}
}
}
opset_import {
version: 1
}
ONNXNgraphImporter:i

AB" GlobalLpPool*
p compute_graphZ
A




b
B




B
\ No newline at end of file
ir_version: 4
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
output: "B"
op_type: "GlobalLpPool"
attribute {
name: "p"
i: 3
type: INT
}
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 3
}
dim {
dim_value: 4
}
}
}
}
}
output {
name: "B"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
}
}
}
}
}
opset_import {
version: 1
}
ir_version: 4
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "X"
input: "W"
output: "Y"
name: "mul_1"
op_type: "Mul"
}
name: "mul test"
initializer {
dims: 3
dims: 2
data_type: 1
float_data: 1
float_data: 2
float_data: 3
float_data: 4
float_data: 5
float_data: 6
name: "W"
}
input {
name: "X"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
version: 7
}
 backend-test:f
"
xy" LeakyRelu*
alpha=test_leakyreluZ
x



b
y



B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "x"
output: "y"
op_type: "LeakyRelu"
attribute {
name: "alpha"
f: 0.10000000149011612
type: FLOAT
}
}
name: "test_leakyrelu"
input {
name: "x"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 4
}
dim {
dim_value: 5
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 4
}
dim {
dim_value: 5
}
}
}
}
}
}
opset_import {
version: 7
}
ir_version: 4
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "X"
input: "W"
input: "R"
input: "B"
input: ""
input: ""
input: ""
input: "P"
output: "Y"
output: "Y_h"
output: "Y_c"
op_type: "LSTM"
attribute {
name: "clip"
f: 0.10000000149011612
type: FLOAT
}
attribute {
name: "direction"
s: "forward"
type: STRING
}
attribute {
name: "hidden_size"
i: 2
type: INT
}
attribute {
name: "input_forget"
i: 0
type: INT
}
}
name: "compute_graph"
input {
name: "X"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
input {
name: "W"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 8
}
dim {
dim_value: 2
}
}
}
}
}
input {
name: "R"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 8
}
dim {
dim_value: 2
}
}
}
}
}
input {
name: "B"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 16
}
}
}
}
}
input {
name: "P"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 6
}
}
}
}
}
output {
name: "Y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y_h"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "Y_c"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
version: 7
}
ngraph ONNXImporter:D
xy"Sign
ign_graphZ
x


b
y


B
 backend-test:b

a
bc"MatMultest_matmul_2dZ
a


Z
b


b
c


B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "a"
input: "b"
output: "c"
op_type: "MatMul"
}
name: "test_matmul_2d"
input {
name: "a"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 4
}
}
}
}
}
input {
name: "b"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 4
}
dim {
dim_value: 3
}
}
}
}
}
output {
name: "c"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 3
}
}
}
}
}
}
opset_import {
version: 7
}
ONNXNgraphImporter:a

A
BC"MatMul compute_graphZ
A

Z
B



b
C


B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
input: "B"
output: "C"
op_type: "MatMul"
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
}
}
}
}
input {
name: "B"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 2
}
dim {
dim_value: 1
}
}
}
}
}
output {
name: "C"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 1
}
}
}
}
}
}
opset_import {
version: 1
}
 backend-test:‘
%
data_0
data_1
data_2result"Maxtest_max_exampleZ
data_0

Z
data_1

Z
data_2

b
result

B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "data_0"
input: "data_1"
input: "data_2"
output: "result"
op_type: "Max"
}
name: "test_max_example"
input {
name: "data_0"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
}
}
}
}
input {
name: "data_1"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
}
}
}
}
input {
name: "data_2"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
}
}
}
}
output {
name: "result"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
}
}
}
}
}
opset_import {
version: 7
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "x"
output: "y"
op_type: "MaxPool"
attribute {
name: "kernel_shape"
ints: 2
ints: 2
type: INTS
}
attribute {
name: "strides"
ints: 2
ints: 2
type: INTS
}
attribute {
name: "pads"
ints: 1
ints: 1
ints: 1
ints: 1
type: INTS
}
}
name: "compute_graph"
input {
name: "x"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 1
}
dim {
dim_value: 4
}
dim {
dim_value: 4
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: 1
shape {
}
}
}
}
}
opset_import {
version: 7
}
 backend-test:
&
data_0
data_1
data_2result"Meantest_mean_exampleZ
data_0

Z
data_1

Z
data_2

b
result

B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "data_0"
input: "data_1"
input: "data_2"
output: "result"
op_type: "Mean"
}
name: "test_mean_example"
input {
name: "data_0"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
}
}
}
}
input {
name: "data_1"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
}
}
}
}
input {
name: "data_2"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
}
}
}
}
output {
name: "result"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
}
}
}
}
}
opset_import {
version: 7
}
 backend-test:v

data_0
data_1result"Mintest_min_two_inputsZ
data_0

Z
data_1

b
result

B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "data_0"
input: "data_1"
output: "result"
op_type: "Min"
}
name: "test_min_two_inputs"
input {
name: "data_0"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
}
}
}
}
input {
name: "data_1"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
}
}
}
}
output {
name: "result"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
}
}
}
}
}
opset_import {
version: 7
}
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "I0"
input: ""
input: "I2"
output: "N0O0"
output: "N0O1"
output: "N0O2"
name: "Node0"
op_type: "TestMissingInOut"
domain: "com.intel.ai"
}
node {
input: "N0O0"
input: "N0O1"
input: "N0O2"
output: "O0"
name: "Node1"
op_type: "TestMissingIn"
domain: "com.intel.ai"
}
name: "test_graph"
input {
name: "I0"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
input {
name: "I2"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "O0"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
domain: "com.intel.ai"
version: 1
}
opset_import {
domain: ""
version: 6
}
ONNXnGraphImporter:o

A
BC" CustomAdd: custom.op compute_graphZ
A


Z
B


b
C


B
\ No newline at end of file
ir_version: 4
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
input: "B"
output: "C"
op_type: "CustomAdd"
domain: "custom.op"
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
input {
name: "B"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "C"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
version: 1
}
 backend-test:
0
indices
depth
valuesy"OneHot*
axistest_onehot_with_axis*:
BdepthZ
indices


Z
depth

Z
values

b
y



B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "indices"
input: "depth"
input: "values"
output: "y"
op_type: "OneHot"
attribute {
name: "axis"
i: 1
type: INT
}
}
name: "test_onehot_with_axis"
initializer {
dims: 1
data_type: 7
int64_data: 10
name: "depth"
}
input {
name: "indices"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
input {
name: "depth"
type {
tensor_type {
elem_type: 7
shape {
dim {
dim_value: 1
}
}
}
}
}
input {
name: "values"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 10
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
version: 9
}
 backend-test:
#
indices
depth
valuesy"OneHottest_onehot_without_axis*: BdepthZ
indices

Z
depth

Z
values

b
y


 B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "indices"
input: "depth"
input: "values"
output: "y"
op_type: "OneHot"
}
name: "test_onehot_without_axis"
initializer {
dims: 1
data_type: 7
int64_data: 12
name: "depth"
}
input {
name: "indices"
type {
tensor_type {
elem_type: 7
shape {
dim {
dim_value: 3
}
}
}
}
}
input {
name: "depth"
type {
tensor_type {
elem_type: 7
shape {
dim {
dim_value: 1
}
}
}
}
}
input {
name: "values"
type {
tensor_type {
elem_type: 7
shape {
dim {
dim_value: 2
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: 6
shape {
dim {
dim_value: 3
}
dim {
dim_value: 12
}
}
}
}
}
}
opset_import {
version: 9
}
#!/usr/bin/env python
# *****************************************************************************
# Copyright 2017-2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# *****************************************************************************
"""Converts protobuf files from binary message format into prototxt format and vice-versa.
Supports files with only '.onnx' or '.prototxt' extensions. Application may accept only single
argument denoting input file. In that case it converts it to the second message format based on the
extension of argument.
Usage:
onnx_prototxt_converter.py INPUT_FILE [OUTPUT_FILE]
Arguments:
INPUT_FILE The path for the input model file.
OUTPUT_FILE The path for the converted model file.
Options:
-h --help show this help message and exit
"""
from docopt import docopt
from google.protobuf import text_format
import onnx
import os
ONNX_SUFFX = '.onnx'
PROTOTXT_SUFFX = '.prototxt'
def _bin2txt(model):
return text_format.MessageToString(model, as_utf8=True, float_format='.17g')
def _txt2bin(model):
m_proto = onnx.ModelProto()
text_format.Parse(model, m_proto, allow_field_number=True)
return m_proto
def _is_bin_file(path):
# check file extension
return os.path.splitext(path)[1] == ONNX_SUFFX
def _is_txt_file(path):
# check file extension
return os.path.splitext(path)[1] == PROTOTXT_SUFFX
_ext_map = {
'.onnx': '.prototxt',
'.prototxt': '.onnx',
}
def _get_output_file_path(path, extension):
return path + _ext_map[extension]
if __name__ == '__main__':
args = docopt(__doc__)
input_file_path = args['INPUT_FILE']
if not args['OUTPUT_FILE']:
output_file_path = _get_output_file_path(*os.path.splitext(input_file_path))
else:
output_file_path = args['OUTPUT_FILE']
print('Converting {} to {}.'.format(input_file_path, output_file_path))
if not os.path.exists(input_file_path):
sys.exit('ERROR: Provided input model path does not exists: {}'.format(input_file_path))
# convert from binary format to text format
if _is_bin_file(input_file_path) and _is_txt_file(output_file_path):
str_msg = _bin2txt(onnx.load_model(input_file_path))
with open(output_file_path, 'w') as f:
f.write(str_msg)
# convert from text format to binary format
elif _is_txt_file(input_file_path) and _is_bin_file(output_file_path):
with open(input_file_path, 'r') as f:
converted_model = _txt2bin(f.read())
onnx.save(converted_model, output_file_path)
else:
sys.exit('ERROR: Provided input or output file has unsupported format.')
ONNXnGraphImporter:c

A
BC"FalseAdd compute_graphZ
A


Z
B


b
C


B
\ No newline at end of file
ir_version: 4
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "A"
input: "B"
output: "C"
op_type: "FalseAdd"
}
name: "compute_graph"
input {
name: "A"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
input {
name: "B"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "C"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 2
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
version: 1
}
 backend-test:y

x
slopey"PRelutest_prelu_exampleZ
x



Z
slope



b
y



B
\ No newline at end of file
ir_version: 3
producer_name: "nGraph ONNX Importer"
graph {
node {
input: "x"
input: "slope"
output: "y"
op_type: "PRelu"
}
name: "test_prelu_example"
input {
name: "x"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 4
}
dim {
dim_value: 5
}
}
}
}
}
input {
name: "slope"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 4
}
dim {
dim_value: 5
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 3
}
dim {
dim_value: 4
}
dim {
dim_value: 5
}
}
}
}
}
}
opset_import {
version: 7
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment