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
05d42945
Commit
05d42945
authored
Nov 15, 2017
by
Robert Kimball
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add utility method to emit function call
parent
24a7db84
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
13 deletions
+39
-13
emitter.cpp
src/ngraph/runtime/cpu/emitter.cpp
+34
-13
emitter.hpp
src/ngraph/runtime/cpu/emitter.hpp
+5
-0
No files found.
src/ngraph/runtime/cpu/emitter.cpp
View file @
05d42945
...
...
@@ -1019,29 +1019,50 @@ void Emitter::EmitReshape(const ngraph::Node* n,
}
}
void
Emitter
::
EmitFunctionCall
(
const
ngraph
::
Node
*
n
,
ExternalFunction
*
ef
,
const
std
::
vector
<
TensorViewInfo
>&
inputs
,
const
std
::
vector
<
TensorViewInfo
>&
outputs
)
void
Emitter
::
generate_call
(
const
std
::
vector
<
TensorViewInfo
>&
inputs
,
const
std
::
vector
<
TensorViewInfo
>&
outputs
,
shared_ptr
<
Function
>
function
)
{
auto
function_call
=
static_cast
<
const
op
::
FunctionCall
*>
(
n
)
;
shared_ptr
<
Function
>
function
=
function_call
->
get_function
()
;
vector
<
string
>
input_names
;
vector
<
string
>
output_names
;
TU
<<
"{ // Call "
<<
function
->
get_name
()
<<
"
\n
"
;
TU
.
indent
++
;
TU
<<
"std::vector<void*> inputs;
\n
"
;
for
(
const
TensorViewInfo
&
input
:
inputs
)
{
TU
<<
"inputs.push_back("
<<
input
.
get_tensor
().
get_name
()
<<
");
\n
"
;
input_names
.
push_back
(
input
.
get_tensor
().
get_name
())
;
}
TU
<<
"
\n
"
;
TU
<<
"std::vector<void*> outputs;
\n
"
;
for
(
const
TensorViewInfo
&
output
:
outputs
)
{
TU
<<
"outputs.push_back("
<<
output
.
get_tensor
().
get_name
()
<<
");
\n
"
;
output_names
.
push_back
(
output
.
get_tensor
().
get_name
())
;
}
TU
<<
"std::vector<void*> inputs =
\n
{"
;
TU
.
indent
++
;
TU
<<
"
\n
"
<<
join
(
input_names
,
",
\n
"
);
TU
.
indent
--
;
TU
<<
"
\n
};
\n
"
;
TU
<<
"std::vector<void*> outputs =
\n
{"
;
TU
.
indent
++
;
TU
<<
"
\n
"
<<
join
(
output_names
,
",
\n
"
);
TU
.
indent
--
;
TU
<<
"
\n
};
\n
"
;
TU
<<
"
\n
"
;
TU
<<
function
->
get_name
()
<<
"(inputs, outputs);
\n
"
;
}
void
Emitter
::
EmitFunctionCall
(
const
ngraph
::
Node
*
n
,
ExternalFunction
*
ef
,
const
std
::
vector
<
TensorViewInfo
>&
inputs
,
const
std
::
vector
<
TensorViewInfo
>&
outputs
)
{
auto
function_call
=
static_cast
<
const
op
::
FunctionCall
*>
(
n
);
shared_ptr
<
Function
>
function
=
function_call
->
get_function
();
TU
<<
"{ // Call "
<<
function
->
get_name
()
<<
"
\n
"
;
TU
.
indent
++
;
generate_call
(
inputs
,
outputs
,
function
);
TU
.
indent
--
;
TU
<<
"}
\n
"
;
}
...
...
src/ngraph/runtime/cpu/emitter.hpp
View file @
05d42945
...
...
@@ -94,6 +94,11 @@ namespace ngraph
void
EMITTER_DECL
(
EmitAsin
);
void
EMITTER_DECL
(
EmitAcos
);
void
EMITTER_DECL
(
EmitAtan
);
private
:
void
generate_call
(
const
std
::
vector
<
TensorViewInfo
>&
inputs
,
const
std
::
vector
<
TensorViewInfo
>&
outputs
,
std
::
shared_ptr
<
Function
>
function
);
};
}
}
...
...
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