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
9afbff99
Commit
9afbff99
authored
Nov 15, 2017
by
Robert Kimball
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add helper methods to emit eigen vectors
parent
4aa8649f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
emitter.cpp
src/ngraph/runtime/cpu/emitter.cpp
+22
-3
emitter.hpp
src/ngraph/runtime/cpu/emitter.hpp
+3
-0
No files found.
src/ngraph/runtime/cpu/emitter.cpp
View file @
9afbff99
...
...
@@ -71,10 +71,11 @@ void Emitter::EmitAdd(const ngraph::Node* n,
->
get_element_type
();
string
type
=
et
.
c_type_string
();
TU
<<
"{ // "
<<
n
->
get_name
()
<<
"
\n
"
;
TU
<<
"{ // "
<<
n
->
get_name
()
<<
"
zzzzz
\n
"
;
TU
.
indent
++
;
TU
<<
"EigenArray1d<"
<<
type
<<
">("
<<
outputs
[
0
].
get_tensor
().
get_name
()
<<
", "
<<
eigen_vector_format
(
outputs
[
0
])
<<
") =
\n
"
;
// TU << "EigenArray1d<" << type << ">(" << outputs[0].get_tensor().get_name() << ", "
// << eigen_vector_format(outputs[0]) << ") =\n";
TU
<<
emit_array1d
(
outputs
[
0
])
<<
" =
\n
"
;
TU
.
indent
++
;
TU
<<
"EigenArray1d<"
<<
type
<<
">("
<<
inputs
[
0
].
get_tensor
().
get_name
()
<<
", "
<<
eigen_vector_format
(
inputs
[
0
])
<<
") +
\n
"
;
...
...
@@ -1649,3 +1650,21 @@ void Emitter::generate_call(const std::vector<TensorViewInfo>& inputs,
TU
<<
"
\n
"
;
TU
<<
function
->
get_name
()
<<
"(inputs, outputs);
\n
"
;
}
string
Emitter
::
emit_vector
(
const
TensorViewInfo
&
tvi
)
{
stringstream
ss
;
const
element
::
Type
&
et
=
tvi
.
get_tensor_view
()
->
get_value_type
()
->
get_element_type
();
ss
<<
"EigenVector<"
<<
et
.
c_type_string
()
<<
">("
<<
tvi
.
get_tensor
().
get_name
()
<<
", "
<<
eigen_vector_format
(
tvi
)
<<
")"
;
return
ss
.
str
();
}
string
Emitter
::
emit_array1d
(
const
TensorViewInfo
&
tvi
)
{
stringstream
ss
;
const
element
::
Type
&
et
=
tvi
.
get_tensor_view
()
->
get_value_type
()
->
get_element_type
();
ss
<<
"EigenArray1d<"
<<
et
.
c_type_string
()
<<
">("
<<
tvi
.
get_tensor
().
get_name
()
<<
", "
<<
eigen_vector_format
(
tvi
)
<<
")"
;
return
ss
.
str
();
}
src/ngraph/runtime/cpu/emitter.hpp
View file @
9afbff99
...
...
@@ -99,6 +99,9 @@ namespace ngraph
void
generate_call
(
const
std
::
vector
<
TensorViewInfo
>&
inputs
,
const
std
::
vector
<
TensorViewInfo
>&
outputs
,
std
::
shared_ptr
<
Function
>
function
);
std
::
string
emit_vector
(
const
TensorViewInfo
&
);
std
::
string
emit_array1d
(
const
TensorViewInfo
&
);
};
}
}
...
...
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