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
ab8ab385
Commit
ab8ab385
authored
Mar 28, 2018
by
Robert Kimball
Committed by
Jayaram Bobba
Mar 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove internal function from external API and add some docs (#774)
parent
a1269685
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
11 deletions
+41
-11
serializer.cpp
src/ngraph/serializer.cpp
+9
-3
serializer.hpp
src/ngraph/serializer.hpp
+32
-8
No files found.
src/ngraph/serializer.cpp
View file @
ab8ab385
...
...
@@ -113,6 +113,8 @@ static std::shared_ptr<ngraph::Function>
static
json
write
(
const
ngraph
::
Function
&
,
bool
binary_constant_data
);
static
json
write
(
const
ngraph
::
Node
&
,
bool
binary_constant_data
);
static
string
serialize
(
shared_ptr
<
ngraph
::
Function
>
func
,
size_t
indent
,
bool
binary_constant_data
);
static
json
write_element_type
(
const
ngraph
::
element
::
Type
&
n
)
{
...
...
@@ -160,7 +162,7 @@ void ngraph::serialize(const string& path, shared_ptr<ngraph::Function> func, si
void
ngraph
::
serialize
(
ostream
&
out
,
shared_ptr
<
ngraph
::
Function
>
func
,
size_t
indent
)
{
string
j
=
serialize
(
func
,
indent
,
true
);
string
j
=
::
serialize
(
func
,
indent
,
true
);
cpio
::
Writer
writer
(
out
);
writer
.
write
(
func
->
get_name
(),
j
.
c_str
(),
static_cast
<
uint32_t
>
(
j
.
size
()));
...
...
@@ -178,8 +180,7 @@ void ngraph::serialize(ostream& out, shared_ptr<ngraph::Function> func, size_t i
writer
.
close
();
}
string
ngraph
::
serialize
(
shared_ptr
<
ngraph
::
Function
>
func
,
size_t
indent
,
bool
binary_constant_data
)
static
string
serialize
(
shared_ptr
<
ngraph
::
Function
>
func
,
size_t
indent
,
bool
binary_constant_data
)
{
json
j
;
vector
<
json
>
functions
;
...
...
@@ -203,6 +204,11 @@ string
return
rc
;
}
std
::
string
ngraph
::
serialize
(
std
::
shared_ptr
<
ngraph
::
Function
>
func
,
size_t
indent
)
{
return
::
serialize
(
func
,
indent
,
false
);
}
shared_ptr
<
ngraph
::
Function
>
ngraph
::
deserialize
(
istream
&
in
)
{
std
::
stringstream
ss
;
...
...
src/ngraph/serializer.hpp
View file @
ab8ab385
...
...
@@ -23,12 +23,36 @@
namespace
ngraph
{
std
::
string
serialize
(
std
::
shared_ptr
<
ngraph
::
Function
>
,
size_t
indent
=
0
,
bool
binary_constant_data
=
false
);
void
serialize
(
const
std
::
string
&
path
,
std
::
shared_ptr
<
ngraph
::
Function
>
,
size_t
indent
=
0
);
void
serialize
(
std
::
ostream
&
out
,
std
::
shared_ptr
<
ngraph
::
Function
>
,
size_t
indent
=
0
);
std
::
shared_ptr
<
ngraph
::
Function
>
deserialize
(
std
::
istream
&
);
std
::
shared_ptr
<
ngraph
::
Function
>
deserialize
(
const
std
::
string
&
);
// @brief Serialize a Function to a json string
// @param func The Function to serialize
// @param indent If 0 then there is no formatting applied and the resulting string is the
// most compact representation. If non-zero then the json string is formatted with the
// indent level specified.
std
::
string
serialize
(
std
::
shared_ptr
<
ngraph
::
Function
>
func
,
size_t
indent
=
0
);
// @brief Serialize a Function to as a json file
// @param path The path to the output file
// @param func The Function to serialize
// @param indent If 0 then there is no formatting applied and the resulting string is the
// most compact representation. If non-zero then the json string is formatted with the
// indent level specified.
void
serialize
(
const
std
::
string
&
path
,
std
::
shared_ptr
<
ngraph
::
Function
>
func
,
size_t
indent
=
0
);
// @brief Serialize a Function to a CPIO file with all constant data stored as binary
// @param out The output stream to which the data is serialized.
// @param func The Function to serialize
// @param indent If 0 then there is no formatting applied and the json is the
// most compact representation. If non-zero then the json is formatted with the
// indent level specified.
void
serialize
(
std
::
ostream
&
out
,
std
::
shared_ptr
<
ngraph
::
Function
>
func
,
size_t
indent
=
0
);
// @brief Deserialize a Function
// @param in An isteam to the input data
std
::
shared_ptr
<
ngraph
::
Function
>
deserialize
(
std
::
istream
&
in
);
// @brief Deserialize a Function
// @param str The json formatted string to deseriailze.
std
::
shared_ptr
<
ngraph
::
Function
>
deserialize
(
const
std
::
string
&
str
);
}
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