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
bf74de2f
Commit
bf74de2f
authored
Oct 13, 2018
by
Robert Kimball
Committed by
Michał Karzyński
Oct 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove the contains() funtion from util as it can lead to bad usage (#1771)
parent
51ad59d3
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
7 additions
and
31 deletions
+7
-31
compiler.cpp
src/ngraph/codegen/compiler.cpp
+2
-1
memory_visualize.cpp
src/ngraph/pass/memory_visualize.cpp
+1
-1
visualize_tree.cpp
src/ngraph/pass/visualize_tree.cpp
+1
-1
cpu_external_function.cpp
src/ngraph/runtime/cpu/cpu_external_function.cpp
+1
-1
gpu_external_function.cpp
src/ngraph/runtime/gpu/gpu_external_function.cpp
+1
-1
util.hpp
src/ngraph/util.hpp
+0
-15
backend_api.cpp
test/backend_api.cpp
+1
-1
util.cpp
test/util.cpp
+0
-10
No files found.
src/ngraph/codegen/compiler.cpp
View file @
bf74de2f
...
...
@@ -298,7 +298,8 @@ void codegen::CompilerCore::add_header_search_path(const string& p)
vector
<
string
>
paths
=
split
(
p
,
';'
);
for
(
const
string
&
path
:
paths
)
{
if
(
!
contains
(
m_extra_search_path_list
,
path
))
if
(
find
(
m_extra_search_path_list
.
begin
(),
m_extra_search_path_list
.
end
(),
path
)
==
m_extra_search_path_list
.
end
())
{
m_extra_search_path_list
.
push_back
(
path
);
HeaderSearchOptions
&
hso
=
m_compiler
->
getInvocation
().
getHeaderSearchOpts
();
...
...
src/ngraph/pass/memory_visualize.cpp
View file @
bf74de2f
...
...
@@ -160,7 +160,7 @@ void pass::MemoryVisualize::draw_tensor_weight(ostream& file, const list<shared_
for
(
const
descriptor
::
Tensor
*
tensor
:
tensor_set
)
{
int
generator_weight
=
compute_op_weight
(
generator_op
[
tensor
]);
if
(
contains
(
largest_live_list
,
tensor
))
if
(
largest_live_list
.
find
(
tensor
)
!=
largest_live_list
.
end
(
))
{
file
<<
" <tr style=
\"
background-color: #f0c0f0
\"
>"
;
}
...
...
src/ngraph/pass/visualize_tree.cpp
View file @
bf74de2f
...
...
@@ -73,7 +73,7 @@ pass::VisualizeTree::VisualizeTree(const string& file_name)
std
::
string
pass
::
VisualizeTree
::
add_attributes
(
shared_ptr
<
Node
>
node
)
{
string
rc
;
if
(
!
contains
(
m_nodes_with_attributes
,
node
))
if
(
m_nodes_with_attributes
.
find
(
node
)
==
m_nodes_with_attributes
.
end
(
))
{
m_nodes_with_attributes
.
insert
(
node
);
rc
=
get_attributes
(
node
);
...
...
src/ngraph/runtime/cpu/cpu_external_function.cpp
View file @
bf74de2f
...
...
@@ -1680,7 +1680,7 @@ string runtime::cpu::CPU_ExternalFunction::emit_op_as_function(const Node& node,
const
descriptor
::
Output
&
output
=
input
.
get_output
();
shared_ptr
<
descriptor
::
Tensor
>
tv
=
output
.
get_tensor_ptr
();
TensorViewWrapper
tvw
{
tv
,
"_arg"
+
to_string
(
arg_index
)};
if
(
!
contains
(
arg_names
,
tvw
.
get_name
()
))
if
(
arg_names
.
find
(
tvw
.
get_name
())
==
arg_names
.
end
(
))
{
arg_names
.
insert
(
tvw
.
get_name
());
if
(
arg_index
++
>
0
)
...
...
src/ngraph/runtime/gpu/gpu_external_function.cpp
View file @
bf74de2f
...
...
@@ -659,7 +659,7 @@ string runtime::gpu::GPU_ExternalFunction::emit_op_as_function(const Node& node,
const
descriptor
::
Output
&
output
=
input
.
get_output
();
shared_ptr
<
descriptor
::
Tensor
>
tv
=
output
.
get_tensor_ptr
();
GPUTensorWrapper
tvw
{
tv
,
"_arg"
+
to_string
(
arg_index
)};
if
(
!
contains
(
arg_names
,
tvw
.
get_name
()
))
if
(
arg_names
.
find
(
tvw
.
get_name
())
==
arg_names
.
end
(
))
{
arg_names
.
insert
(
tvw
.
get_name
());
if
(
arg_index
++
>
0
)
...
...
src/ngraph/util.hpp
View file @
bf74de2f
...
...
@@ -69,21 +69,6 @@ namespace ngraph
return
os
.
str
();
}
template
<
typename
U
,
typename
T
>
bool
contains
(
const
U
&
container
,
const
T
&
obj
)
{
bool
rc
=
false
;
for
(
auto
o
:
container
)
{
if
(
o
==
obj
)
{
rc
=
true
;
break
;
}
}
return
rc
;
}
size_t
hash_combine
(
const
std
::
vector
<
size_t
>&
list
);
void
dump
(
std
::
ostream
&
out
,
const
void
*
,
size_t
);
...
...
test/backend_api.cpp
View file @
bf74de2f
...
...
@@ -27,7 +27,7 @@ TEST(backend_api, registered_devices)
vector
<
string
>
devices
=
runtime
::
Backend
::
get_registered_devices
();
EXPECT_GE
(
devices
.
size
(),
0
);
EXPECT_TRUE
(
contains
(
devices
,
"INTERPRETER"
));
EXPECT_TRUE
(
find
(
devices
.
begin
(),
devices
.
end
(),
"INTERPRETER"
)
!=
devices
.
end
(
));
}
TEST
(
backend_api
,
invalid_name
)
...
...
test/util.cpp
View file @
bf74de2f
...
...
@@ -134,16 +134,6 @@ TEST(util, trim)
EXPECT_STREQ
(
"test"
,
trim
(
"
\t
test
\t
"
).
c_str
());
}
TEST
(
util
,
contains
)
{
vector
<
int
>
v1
=
{
1
,
2
,
3
,
4
,
5
,
6
};
EXPECT_TRUE
(
contains
(
v1
,
1
));
EXPECT_TRUE
(
contains
(
v1
,
4
));
EXPECT_TRUE
(
contains
(
v1
,
6
));
EXPECT_FALSE
(
contains
(
v1
,
8
));
}
#if defined(NGRAPH_INTERPRETER_ENABLE)
TEST
(
util
,
all_close
)
{
...
...
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