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
ee96e8d1
Commit
ee96e8d1
authored
6 years ago
by
Artur Wojcik
Committed by
Robert Kimball
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "[ONNX] return single nGraph function with multiple outputs (#2017)" (#2165)
This reverts commit
c5b082c6
.
parent
c5b082c6
No related merge requests found
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
90 additions
and
175 deletions
+90
-175
__init__.py
python/ngraph/impl/onnx_import/__init__.py
+4
-2
runtime.py
python/ngraph/runtime.py
+10
-14
onnx_import.cpp
python/pyngraph/onnx_import/onnx_import.cpp
+21
-6
regmodule_pyngraph_op.cpp
python/pyngraph/ops/regmodule_pyngraph_op.cpp
+0
-1
regmodule_pyngraph_op.hpp
python/pyngraph/ops/regmodule_pyngraph_op.hpp
+0
-1
result.cpp
python/pyngraph/ops/result.cpp
+0
-32
result.hpp
python/pyngraph/ops/result.hpp
+0
-23
pyngraph.cpp
python/pyngraph/pyngraph.cpp
+0
-2
result_vector.cpp
python/pyngraph/result_vector.cpp
+0
-41
result_vector.hpp
python/pyngraph/result_vector.hpp
+0
-23
setup.py
python/setup.py
+0
-2
test_onnx_import.py
python/test/ngraph/test_onnx_import.py
+2
-2
test_ops_unary.py
python/test/ngraph/test_ops_unary.py
+2
-2
graph.cpp
src/ngraph/frontend/onnx_import/core/graph.cpp
+0
-10
graph.hpp
src/ngraph/frontend/onnx_import/core/graph.hpp
+0
-1
onnx.cpp
src/ngraph/frontend/onnx_import/onnx.cpp
+21
-9
onnx.hpp
src/ngraph/frontend/onnx_import/onnx.hpp
+29
-3
serialize_onnx.cpp
src/tools/serialize_onnx/serialize_onnx.cpp
+1
-1
onnx_import.cpp
test/onnx_import.cpp
+0
-0
No files found.
python/ngraph/impl/onnx_import/__init__.py
View file @
ee96e8d1
...
...
@@ -32,5 +32,7 @@ else:
flags
=
sys
.
getdlopenflags
()
|
ctypes
.
RTLD_GLOBAL
sys
.
setdlopenflags
(
flags
)
from
_pyngraph_onnx_import
import
import_onnx_model
from
_pyngraph_onnx_import
import
import_onnx_model_file
from
_pyngraph_onnx_import
import
load_onnx_model
from
_pyngraph_onnx_import
import
load_onnx_model_file
from
_pyngraph_onnx_import
import
import_onnx_function
from
_pyngraph_onnx_import
import
import_onnx_function_file
This diff is collapsed.
Click to expand it.
python/ngraph/runtime.py
View file @
ee96e8d1
...
...
@@ -67,7 +67,6 @@ class Computation(object):
self
.
runtime
=
runtime
self
.
function
=
ng_function
self
.
parameters
=
ng_function
.
get_parameters
()
self
.
results
=
ng_function
.
get_results
()
self
.
tensor_views
=
[]
# type: List[Tensor]
for
parameter
in
self
.
parameters
:
...
...
@@ -75,12 +74,6 @@ class Computation(object):
element_type
=
parameter
.
get_element_type
()
self
.
tensor_views
.
append
(
runtime
.
backend
.
create_tensor
(
element_type
,
shape
))
self
.
result_views
=
[]
# type: List[Tensor]
for
result
in
self
.
results
:
shape
=
result
.
get_shape
()
element_type
=
result
.
get_element_type
()
self
.
result_views
.
append
(
runtime
.
backend
.
create_tensor
(
element_type
,
shape
))
def
__repr__
(
self
):
# type: () -> str
params_string
=
', '
.
join
([
param
.
name
for
param
in
self
.
parameters
])
return
'<Computation: {}({})>'
.
format
(
self
.
function
.
get_name
(),
params_string
)
...
...
@@ -92,15 +85,18 @@ class Computation(object):
value
=
np
.
array
(
value
)
Computation
.
_write_ndarray_to_tensor_view
(
value
,
tensor_view
)
self
.
runtime
.
backend
.
call
(
self
.
function
,
self
.
result_views
,
self
.
tensor_views
)
result_element_type
=
self
.
function
.
get_output_element_type
(
0
)
result_shape
=
self
.
function
.
get_output_shape
(
0
)
result_dtype
=
get_dtype
(
result_element_type
)
result_view
=
self
.
runtime
.
backend
.
create_tensor
(
result_element_type
,
result_shape
)
result_arr
=
np
.
empty
(
result_shape
,
dtype
=
result_dtype
)
results
=
[]
for
result_view
in
self
.
result_views
:
result
=
np
.
ndarray
(
result_view
.
shape
,
dtype
=
get_dtype
(
result_view
.
element_type
))
Computation
.
_read_tensor_view_to_ndarray
(
result_view
,
result
)
results
.
append
(
result
)
self
.
runtime
.
backend
.
call
(
self
.
function
,
[
result_view
],
self
.
tensor_views
)
return
results
Computation
.
_read_tensor_view_to_ndarray
(
result_view
,
result_arr
)
result_arr
=
result_arr
.
reshape
(
result_shape
)
return
result_arr
def
serialize
(
self
,
indent
=
0
):
# type: (int) -> str
"""Serialize function (compute graph) to a JSON string.
...
...
This diff is collapsed.
Click to expand it.
python/pyngraph/onnx_import/onnx_import.cpp
View file @
ee96e8d1
...
...
@@ -28,19 +28,34 @@
namespace
py
=
pybind11
;
static
std
::
shared_ptr
<
ngraph
::
Function
>
import_onnx_model
(
const
std
::
string
&
model_proto
)
static
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
Function
>>
load_onnx_model
(
const
std
::
string
&
model_proto
)
{
std
::
istringstream
iss
(
model_proto
,
std
::
ios_base
::
binary
|
std
::
ios_base
::
in
);
return
ngraph
::
onnx_import
::
import
_onnx_model
(
iss
);
return
ngraph
::
onnx_import
::
load
_onnx_model
(
iss
);
}
static
std
::
shared_ptr
<
ngraph
::
Function
>
import_onnx_
model_file
(
const
std
::
string
&
filename
)
static
std
::
shared_ptr
<
ngraph
::
Function
>
import_onnx_
function
(
const
std
::
string
&
model_proto
)
{
return
ngraph
::
onnx_import
::
import_onnx_model
(
filename
);
std
::
istringstream
iss
(
model_proto
,
std
::
ios_base
::
binary
|
std
::
ios_base
::
in
);
return
ngraph
::
onnx_import
::
import_onnx_function
(
iss
);
}
static
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
Function
>>
load_onnx_model_file
(
const
std
::
string
&
filename
)
{
return
ngraph
::
onnx_import
::
load_onnx_model
(
filename
);
}
static
std
::
shared_ptr
<
ngraph
::
Function
>
import_onnx_function_file
(
const
std
::
string
&
filename
)
{
return
ngraph
::
onnx_import
::
import_onnx_function
(
filename
);
}
void
regmodule_pyngraph_onnx_import
(
py
::
module
mod
)
{
mod
.
def
(
"import_onnx_model"
,
&
import_onnx_model
);
mod
.
def
(
"import_onnx_model_file"
,
&
import_onnx_model_file
);
mod
.
def
(
"load_onnx_model"
,
&
load_onnx_model
);
mod
.
def
(
"import_onnx_function"
,
&
import_onnx_function
);
mod
.
def
(
"load_onnx_model_file"
,
&
load_onnx_model_file
);
mod
.
def
(
"import_onnx_function_file"
,
&
import_onnx_function_file
);
}
This diff is collapsed.
Click to expand it.
python/pyngraph/ops/regmodule_pyngraph_op.cpp
View file @
ee96e8d1
...
...
@@ -93,5 +93,4 @@ void regmodule_pyngraph_op(py::module m_op)
regclass_pyngraph_op_Tan
(
m_op
);
regclass_pyngraph_op_Tanh
(
m_op
);
regclass_pyngraph_op_TopK
(
m_op
);
regclass_pyngraph_op_Result
(
m_op
);
}
This diff is collapsed.
Click to expand it.
python/pyngraph/ops/regmodule_pyngraph_op.hpp
View file @
ee96e8d1
...
...
@@ -68,7 +68,6 @@
#include "pyngraph/ops/relu.hpp"
#include "pyngraph/ops/replace_slice.hpp"
#include "pyngraph/ops/reshape.hpp"
#include "pyngraph/ops/result.hpp"
#include "pyngraph/ops/reverse.hpp"
#include "pyngraph/ops/select.hpp"
#include "pyngraph/ops/sign.hpp"
...
...
This diff is collapsed.
Click to expand it.
python/pyngraph/ops/result.cpp
deleted
100644 → 0
View file @
c5b082c6
//*****************************************************************************
// Copyright 2017-2018 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.
//*****************************************************************************
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <string>
#include "ngraph/node.hpp"
#include "ngraph/op/result.hpp"
#include "pyngraph/ops/result.hpp"
namespace
py
=
pybind11
;
void
regclass_pyngraph_op_Result
(
py
::
module
m
)
{
py
::
class_
<
ngraph
::
op
::
Result
,
std
::
shared_ptr
<
ngraph
::
op
::
Result
>
,
ngraph
::
Node
>
result
(
m
,
"Result"
);
result
.
doc
()
=
"ngraph.impl.op.Result wraps ngraph::op::Result"
;
}
This diff is collapsed.
Click to expand it.
python/pyngraph/ops/result.hpp
deleted
100644 → 0
View file @
c5b082c6
//*****************************************************************************
// Copyright 2017-2018 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.
//*****************************************************************************
#pragma once
#include <pybind11/pybind11.h>
namespace
py
=
pybind11
;
void
regclass_pyngraph_op_Result
(
py
::
module
m
);
This diff is collapsed.
Click to expand it.
python/pyngraph/pyngraph.cpp
View file @
ee96e8d1
...
...
@@ -27,7 +27,6 @@
#include "pyngraph/ops/util/regmodule_pyngraph_op_util.hpp"
#include "pyngraph/parameter_vector.hpp"
#include "pyngraph/passes/regmodule_pyngraph_passes.hpp"
#include "pyngraph/result_vector.hpp"
#include "pyngraph/runtime/regmodule_pyngraph_runtime.hpp"
#include "pyngraph/serializer.hpp"
#include "pyngraph/shape.hpp"
...
...
@@ -59,5 +58,4 @@ PYBIND11_MODULE(_pyngraph, m)
regmodule_pyngraph_runtime
(
m
);
regmodule_pyngraph_passes
(
m
);
regmodule_pyngraph_util
(
m
);
regclass_pyngraph_ResultVector
(
m
);
}
This diff is collapsed.
Click to expand it.
python/pyngraph/result_vector.cpp
deleted
100644 → 0
View file @
c5b082c6
//*****************************************************************************
// Copyright 2017-2018 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.
//*****************************************************************************
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "ngraph/op/result.hpp" // ngraph::op::Result
#include "ngraph/result_vector.hpp"
#include "pyngraph/ops/result.hpp"
#include "pyngraph/result_vector.hpp"
namespace
py
=
pybind11
;
void
regclass_pyngraph_ResultVector
(
py
::
module
m
)
{
py
::
class_
<
ngraph
::
ResultVector
,
std
::
shared_ptr
<
ngraph
::
ResultVector
>>
result_vector
(
m
,
"ResultVector"
);
result_vector
.
doc
()
=
"ngraph.impl.ResultVector wraps ngraph::ResultVector"
;
result_vector
.
def
(
py
::
init
<
const
std
::
initializer_list
<
std
::
shared_ptr
<
ngraph
::
op
::
Result
>>&>
());
result_vector
.
def
(
py
::
init
<
const
std
::
vector
<
std
::
shared_ptr
<
ngraph
::
op
::
Result
>>&>
());
result_vector
.
def
(
py
::
init
<
const
ngraph
::
ResultVector
&>
());
result_vector
.
def
(
"__len__"
,
[](
const
ngraph
::
ResultVector
&
v
)
{
return
v
.
size
();
});
result_vector
.
def
(
"__getitem__"
,
[](
const
ngraph
::
ResultVector
&
v
,
int
key
)
{
return
v
[
key
];
});
result_vector
.
def
(
"__iter__"
,
[](
ngraph
::
ResultVector
&
v
)
{
return
py
::
make_iterator
(
v
.
begin
(),
v
.
end
());
},
py
::
keep_alive
<
0
,
1
>
());
/* Keep vector alive while iterator is used */
}
This diff is collapsed.
Click to expand it.
python/pyngraph/result_vector.hpp
deleted
100644 → 0
View file @
c5b082c6
//*****************************************************************************
// Copyright 2017-2018 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.
//*****************************************************************************
#pragma once
#include <pybind11/pybind11.h>
namespace
py
=
pybind11
;
void
regclass_pyngraph_ResultVector
(
py
::
module
m
);
This diff is collapsed.
Click to expand it.
python/setup.py
View file @
ee96e8d1
...
...
@@ -149,7 +149,6 @@ sources = [
'pyngraph/parameter_vector.cpp'
,
'pyngraph/pyngraph.cpp'
,
'pyngraph/util.cpp'
,
'pyngraph/result_vector.cpp'
,
'pyngraph/ops/util/arithmetic_reduction.cpp'
,
'pyngraph/ops/util/binary_elementwise_comparison.cpp'
,
'pyngraph/ops/util/op_annotations.cpp'
,
...
...
@@ -224,7 +223,6 @@ sources = [
'pyngraph/ops/min.cpp'
,
'pyngraph/ops/batch_norm.cpp'
,
'pyngraph/ops/softmax.cpp'
,
'pyngraph/ops/result.cpp'
,
'pyngraph/runtime/backend.cpp'
,
'pyngraph/runtime/regmodule_pyngraph_runtime.cpp'
,
'pyngraph/runtime/tensor.cpp'
,
...
...
This diff is collapsed.
Click to expand it.
python/test/ngraph/test_onnx_import.py
View file @
ee96e8d1
...
...
@@ -17,13 +17,13 @@
import
os
import
numpy
as
np
from
ngraph.impl.onnx_import
import
import
_onnx_model_file
from
ngraph.impl.onnx_import
import
load
_onnx_model_file
from
test.ngraph.util
import
get_runtime
def
test_import_onnx_function
():
model_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'models/add_abc.onnx'
)
ng_function
=
import_onnx_model_file
(
model_path
)
ng_function
=
load_onnx_model_file
(
model_path
)[
0
]
dtype
=
np
.
float32
value_a
=
np
.
array
([
1.0
],
dtype
=
dtype
)
...
...
This diff is collapsed.
Click to expand it.
python/test/ngraph/test_ops_unary.py
View file @
ee96e8d1
...
...
@@ -48,10 +48,10 @@ def test_unary_op_array(ng_api_fn, numpy_fn, range_start, range_end):
input_data
=
range_start
+
np
.
random
.
rand
(
2
,
3
,
4
)
*
(
range_end
-
range_start
)
expected
=
numpy_fn
(
input_data
)
result
=
run_op_node
([
input_data
],
ng_api_fn
)
[
0
]
result
=
run_op_node
([
input_data
],
ng_api_fn
)
np
.
testing
.
assert_allclose
(
result
,
expected
,
rtol
=
0.001
)
result
=
run_op_numeric_data
(
input_data
,
ng_api_fn
)
[
0
]
result
=
run_op_numeric_data
(
input_data
,
ng_api_fn
)
np
.
testing
.
assert_allclose
(
result
,
expected
,
rtol
=
0.001
)
...
...
This diff is collapsed.
Click to expand it.
src/ngraph/frontend/onnx_import/core/graph.cpp
View file @
ee96e8d1
...
...
@@ -95,16 +95,6 @@ namespace ngraph
}
}
NodeVector
Graph
::
get_ng_outputs
()
const
{
NodeVector
results
;
for
(
const
auto
&
output
:
m_graph_proto
->
output
())
{
results
.
emplace_back
(
get_ng_node_from_cache
(
output
.
name
()));
}
return
results
;
}
}
// namespace onnx_import
}
// namespace ngraph
This diff is collapsed.
Click to expand it.
src/ngraph/frontend/onnx_import/core/graph.hpp
View file @
ee96e8d1
...
...
@@ -38,7 +38,6 @@ namespace ngraph
const
std
::
vector
<
Node
>&
get_nodes
()
const
{
return
m_nodes
;
}
const
std
::
vector
<
ValueInfo
>&
get_inputs
()
const
{
return
m_inputs
;
}
const
std
::
vector
<
ValueInfo
>&
get_outputs
()
const
{
return
m_outputs
;
}
NodeVector
get_ng_outputs
()
const
;
const
ParameterVector
&
get_ng_parameters
()
const
{
return
m_parameters
;
}
std
::
shared_ptr
<
ngraph
::
Node
>
get_ng_node_from_cache
(
const
std
::
string
&
name
)
const
{
...
...
This diff is collapsed.
Click to expand it.
src/ngraph/frontend/onnx_import/onnx.cpp
View file @
ee96e8d1
...
...
@@ -15,7 +15,6 @@
//*****************************************************************************
#include <fstream>
#include <memory>
#include "core/graph.hpp"
#include "core/model.hpp"
...
...
@@ -51,32 +50,45 @@ namespace ngraph
}
// namespace error
}
// namespace detail
std
::
shared_ptr
<
Function
>
import_onnx_model
(
std
::
istream
&
sin
,
const
Weights
&
weights
)
std
::
vector
<
std
::
shared_ptr
<
Function
>>
load_onnx_model
(
std
::
istream
&
sin
,
const
Weights
&
weights
)
{
onnx
::
ModelProto
model_proto
;
if
(
!
model_proto
.
ParseFromIstream
(
&
sin
))
{
throw
detail
::
error
::
stream_parse
{
sin
};
}
std
::
vector
<
std
::
shared_ptr
<
Function
>>
output_functions
;
Model
model
{
model_proto
};
Graph
graph
{
model_proto
.
graph
(),
model
,
weights
};
auto
function
=
std
::
make_shared
<
Function
>
(
graph
.
get_ng_outputs
(),
graph
.
get_ng_parameters
(),
graph
.
get_name
());
for
(
std
::
size_t
i
{
0
};
i
<
function
->
get_output_size
();
++
i
)
for
(
const
auto
&
output
:
graph
.
get_outputs
())
{
function
->
get_output_op
(
i
)
->
set_name
(
graph
.
get_outputs
().
at
(
i
).
get_name
());
output_functions
.
emplace_back
(
std
::
make_shared
<
Function
>
(
graph
.
get_ng_node_from_cache
(
output
.
get_name
()),
graph
.
get_ng_parameters
()));
}
return
function
;
return
output_functions
;
}
std
::
shared_ptr
<
Function
>
import_onnx_model
(
const
std
::
string
&
path
,
const
Weights
&
weights
)
std
::
vector
<
std
::
shared_ptr
<
Function
>>
load_onnx_model
(
const
std
::
string
&
path
,
const
Weights
&
weights
)
{
std
::
ifstream
ifs
{
path
,
std
::
ios
::
in
|
std
::
ios
::
binary
};
if
(
!
ifs
.
is_open
())
{
throw
detail
::
error
::
file_open
{
path
};
}
return
import_onnx_model
(
ifs
,
weights
);
return
load_onnx_model
(
ifs
,
weights
);
}
std
::
shared_ptr
<
Function
>
import_onnx_function
(
std
::
istream
&
sin
,
const
Weights
&
weights
)
{
return
load_onnx_model
(
sin
,
weights
).
front
();
}
std
::
shared_ptr
<
Function
>
import_onnx_function
(
const
std
::
string
&
path
,
const
Weights
&
weights
)
{
return
load_onnx_model
(
path
,
weights
).
front
();
}
void
register_operator
(
const
std
::
string
&
name
,
...
...
This diff is collapsed.
Click to expand it.
src/ngraph/frontend/onnx_import/onnx.hpp
View file @
ee96e8d1
...
...
@@ -40,6 +40,31 @@ namespace ngraph
const
std
::
string
&
domain
,
Operator
fn
);
/// \brief Convert an ONNX model to nGraph functions
/// The function translated serialized ONNX model to nGraph functions. The serialized
/// ONNX model is read from input stream.
/// \param sin input stream (e.g. file stream, memory stream, etc),
/// \param weights weights associated with the model. If weights are embedded into
/// the model this parameter shall be empty. Having weights in a model
/// and providing through this parameters is invalid (the weights from
/// the model will take precedence).
/// \return The function returns a vector of nGraph functions. The number of functions
/// depends on number of outputs from ONNX graph.
std
::
vector
<
std
::
shared_ptr
<
Function
>>
load_onnx_model
(
std
::
istream
&
sin
,
const
Weights
&
weights
=
{});
/// \brief Convert an ONNX model to nGraph functions
/// The function translated serialized ONNX model to nGraph functions. The ONNX model
/// is read from ONNX file.
/// \param filename file name (relative or absolute path name),
/// \param weights weights associated with the model. If weights are embedded into
/// the model this parameter shall be empty. Having weights in a model
/// and providing through this parameters is invalid (the weights from
/// the model will take precedence).
/// \return The function returns a vector of nGraph functions. The number of functions
/// depends on number of outputs from ONNX graph.
std
::
vector
<
std
::
shared_ptr
<
Function
>>
load_onnx_model
(
const
std
::
string
&
filename
,
const
Weights
&
weights
=
{});
/// \brief Convert an ONNX model to nGraph function
/// The function translated serialized ONNX model to nGraph function. The serialized
/// ONNX model is read from input stream.
...
...
@@ -49,7 +74,8 @@ namespace ngraph
/// and providing through this parameters is invalid (the weights from
/// the model will take precedence).
/// \return The function returns a nGraph function representing single output from graph.
std
::
shared_ptr
<
Function
>
import_onnx_model
(
std
::
istream
&
sin
,
const
Weights
&
weights
=
{});
std
::
shared_ptr
<
Function
>
import_onnx_function
(
std
::
istream
&
sin
,
const
Weights
&
weights
=
{});
/// \brief Convert an ONNX model to nGraph functions
/// The function translated serialized ONNX model to nGraph functions. The ONNX model
...
...
@@ -60,8 +86,8 @@ namespace ngraph
/// and providing through this parameters is invalid (the weights from
/// the model will take precedence).
/// \return The function returns a nGraph function representing single output from graph.
std
::
shared_ptr
<
Function
>
import_onnx_
model
(
const
std
::
string
&
filename
,
const
Weights
&
weights
=
{});
std
::
shared_ptr
<
Function
>
import_onnx_
function
(
const
std
::
string
&
filename
,
const
Weights
&
weights
=
{});
}
// namespace onnx_import
...
...
This diff is collapsed.
Click to expand it.
src/tools/serialize_onnx/serialize_onnx.cpp
View file @
ee96e8d1
...
...
@@ -66,7 +66,7 @@ int main(int argc, char** argv)
ifstream
f
(
input
);
if
(
f
)
{
s
td
::
shared_ptr
<
ngraph
::
Function
>
function
=
ngraph
::
onnx_import
::
import_onnx_model
(
input
);
s
hared_ptr
<
ngraph
::
Function
>
function
=
ngraph
::
onnx_import
::
import_onnx_function
(
input
);
ngraph
::
stopwatch
timer
;
timer
.
start
();
...
...
This diff is collapsed.
Click to expand it.
test/onnx_import.cpp
View file @
ee96e8d1
This diff is collapsed.
Click to expand it.
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