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
14e2c9b8
Unverified
Commit
14e2c9b8
authored
Nov 22, 2017
by
Robert Kimball
Committed by
GitHub
Nov 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into bob/simple_function_call
parents
39e61aae
41f9ec92
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
3 deletions
+33
-3
CMakeLists.txt
CMakeLists.txt
+3
-0
compiler.cpp
src/ngraph/codegen/compiler.cpp
+1
-1
emitter.cpp
src/ngraph/runtime/cpu/emitter.cpp
+2
-2
backend_test.in.cpp
test/backend_test.in.cpp
+27
-0
No files found.
CMakeLists.txt
View file @
14e2c9b8
...
...
@@ -43,6 +43,9 @@ endif()
set
(
CMAKE_DISABLE_SOURCE_CHANGES ON
)
set
(
CMAKE_DISABLE_IN_SOURCE_BUILD ON
)
# Create compilation database compile_commands.json
set
(
CMAKE_EXPORT_COMPILE_COMMANDS ON
)
# set directory where the custom finders live
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_SOURCE_DIR
}
/cmake/Modules/"
)
...
...
src/ngraph/codegen/compiler.cpp
View file @
14e2c9b8
...
...
@@ -341,7 +341,7 @@ std::unique_ptr<llvm::Module> StaticCompiler::compile(const string& source)
void
StaticCompiler
::
generate_pch
(
const
string
&
source
)
{
m_pch_path
=
file_util
::
path_join
(
file_util
::
get_temp_directory
(),
"ngraph.pch"
);
m_pch_path
=
file_util
::
tmp_filename
(
);
m_compiler
->
getFrontendOpts
().
OutputFile
=
m_pch_path
;
// Map code filename to a memoryBuffer
...
...
src/ngraph/runtime/cpu/emitter.cpp
View file @
14e2c9b8
...
...
@@ -479,14 +479,14 @@ void Emitter::EmitParameterizedConstantBool(const ngraph::Node* n,
// Special case where constant is stored directly in the output
for
(
size_t
i
=
0
;
i
<
value
.
size
();
i
++
)
{
TU
<<
outputs
[
0
].
get_tensor
().
get_name
()
<<
"["
<<
i
<<
"] = static_cast<
bool
>("
TU
<<
outputs
[
0
].
get_tensor
().
get_name
()
<<
"["
<<
i
<<
"] = static_cast<
char
>("
<<
(
value
[
i
]
?
"true"
:
"false"
)
<<
");
\n
"
;
}
}
else
{
TU
<<
"// this should be const but eigen hates const :(
\n
"
;
TU
<<
"
bool
"
<<
outputs
[
0
].
get_tensor
().
get_name
()
<<
"[] = {
\n
"
;
TU
<<
"
char
"
<<
outputs
[
0
].
get_tensor
().
get_name
()
<<
"[] = {
\n
"
;
for
(
size_t
i
=
0
;
i
<
value
.
size
();
i
++
)
{
if
(
i
!=
0
)
...
...
test/backend_test.in.cpp
View file @
14e2c9b8
...
...
@@ -2708,3 +2708,30 @@ TEST(${BACKEND_NAME}, sign)
(
*
cf
)({
a
},
{
result
});
ASSERT_EQ
((
vector
<
float
>
{
1
,
-
1
,
0
,
-
1
,
1
,
0
}),
result
->
get_vector
<
float
>
());
}
TEST
(
$
{
BACKEND_NAME
},
constant_equality_bool
)
{
auto
shape
=
Shape
{
4
};
// auto A = make_shared<op::Parameter>(element::Bool::element_type(), shape);
// auto B = make_shared<op::Parameter>(element::Bool::element_type(), shape);
// auto result_type = make_shared<TensorViewType>(element::Bool::element_type(), shape);
// auto f = make_shared<Function>(make_shared<op::Equal>(A, B), result_type, op::Parameters{A, B});
auto
a
=
runtime
::
make_tensor
<
element
::
Bool
>
(
shape
,
{
true
,
false
,
true
,
false
});
auto
A
=
make_shared
<
op
::
ParameterizedConstant
<
element
::
Bool
>>
(
shape
,
a
);
auto
b
=
runtime
::
make_tensor
<
element
::
Bool
>
(
shape
,
{
true
,
true
,
true
,
true
});
auto
B
=
make_shared
<
op
::
ParameterizedConstant
<
element
::
Bool
>>
(
shape
,
b
);
auto
rt
=
make_shared
<
TensorViewType
>
(
element
::
Bool
::
element_type
(),
shape
);
auto
f
=
make_shared
<
Function
>
(
make_shared
<
op
::
Equal
>
(
A
,
B
),
rt
,
op
::
Parameters
{});
auto
manager
=
runtime
::
Manager
::
get
(
"${BACKEND_NAME}"
);
auto
external
=
manager
->
compile
(
f
);
auto
backend
=
manager
->
allocate_backend
();
auto
cf
=
backend
->
make_call_frame
(
external
);
// Create some tensors for input/output
auto
result
=
backend
->
make_primary_tensor_view
(
element
::
Bool
::
element_type
(),
shape
);
(
*
cf
)({},
{
result
});
ASSERT_EQ
((
vector
<
char
>
{
true
,
false
,
true
,
false
}),
result
->
get_vector
<
char
>
());
}
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