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
41e1182f
Commit
41e1182f
authored
Jun 14, 2019
by
Robert Kimball
Committed by
Scott Cyphers
Jun 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add copy of friendly name to ngraph::copy_function (#3047)
* Copy friendly name when copying node * add unit test * style
parent
eb43fcc5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
graph_util.cpp
src/ngraph/graph_util.cpp
+7
-1
util.cpp
test/util.cpp
+23
-0
No files found.
src/ngraph/graph_util.cpp
View file @
41e1182f
...
...
@@ -249,11 +249,17 @@ std::list<std::shared_ptr<ngraph::Node>>
}
auto
cloned_node
=
node
->
copy_with_new_args
(
cloned_args
);
//copy control dependencies
//
copy control dependencies
for
(
auto
cdep
:
node
->
get_control_dependencies
())
{
cloned_node
->
add_control_dependency
(
node_map
.
at
(
cdep
.
get
()));
}
if
(
node
->
get_friendly_name
()
!=
node
->
get_name
())
{
// There is a friendly name for this node so copy it
cloned_node
->
set_friendly_name
(
node
->
get_friendly_name
());
}
node_map
[
node
.
get
()]
=
cloned_node
;
}
}
...
...
test/util.cpp
View file @
41e1182f
...
...
@@ -634,3 +634,26 @@ TEST(util, apply_permutation_pshape_rank_dynamic_inviable_permutation_fails)
{
ASSERT_THROW
(
apply_permutation
(
PartialShape
::
dynamic
(),
AxisVector
{
0
,
1
,
2
,
2
}),
CheckFailure
);
}
TEST
(
util
,
clone_function_friendly_name
)
{
Shape
shape
{
2
,
2
};
auto
A
=
make_shared
<
op
::
Parameter
>
(
element
::
f32
,
shape
);
auto
B
=
make_shared
<
op
::
Parameter
>
(
element
::
f32
,
shape
);
auto
f
=
make_shared
<
Function
>
(
make_shared
<
op
::
Add
>
(
A
,
B
),
ParameterVector
{
A
,
B
});
A
->
set_friendly_name
(
"A"
);
B
->
set_friendly_name
(
"B"
);
auto
g
=
clone_function
(
*
f
);
bool
found_A
=
false
;
bool
found_B
=
false
;
for
(
auto
parameter
:
g
->
get_parameters
())
{
found_A
|=
parameter
->
get_friendly_name
()
==
"A"
;
found_B
|=
parameter
->
get_friendly_name
()
==
"B"
;
}
EXPECT_TRUE
(
found_A
);
EXPECT_TRUE
(
found_B
);
}
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