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
886eb1ec
Commit
886eb1ec
authored
Nov 21, 2017
by
Robert Kimball
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add some new unit tests that are failing
parent
b95135c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
1 deletion
+45
-1
pass_liveness.cpp
test/pass_liveness.cpp
+25
-1
pass_memory_layout.cpp
test/pass_memory_layout.cpp
+20
-0
No files found.
test/pass_liveness.cpp
View file @
886eb1ec
...
...
@@ -34,7 +34,31 @@ using namespace std;
using
namespace
ngraph
;
namespace
ng
=
ngraph
;
TEST
(
pass
,
liveness
)
TEST
(
liveness
,
constant
)
{
auto
shape
=
Shape
{
1
};
auto
c
=
make_shared
<
op
::
Constant
>
(
element
::
i32
,
Shape
{},
"5"
);
auto
rt
=
make_shared
<
TensorViewType
>
(
element
::
Float32
::
element_type
(),
shape
);
auto
f
=
make_shared
<
Function
>
(
make_shared
<
op
::
Negative
>
(
c
),
rt
,
op
::
Parameters
{});
pass
::
Manager
pass_manager
;
pass_manager
.
register_pass
<
pass
::
TopologicalSort
>
();
pass_manager
.
register_pass
<
pass
::
Liveness
>
();
pass_manager
.
run_passes
(
f
);
auto
tmp
=
f
->
get_ordered_ops
();
vector
<
shared_ptr
<
Node
>>
sorted
{
tmp
.
begin
(),
tmp
.
end
()};
ASSERT_EQ
(
2
,
sorted
.
size
());
EXPECT_EQ
(
0
,
sorted
[
0
]
->
liveness_live_list
.
size
());
EXPECT_EQ
(
0
,
sorted
[
0
]
->
liveness_new_list
.
size
());
EXPECT_EQ
(
0
,
sorted
[
0
]
->
liveness_free_list
.
size
());
EXPECT_EQ
(
0
,
sorted
[
1
]
->
liveness_live_list
.
size
());
EXPECT_EQ
(
0
,
sorted
[
1
]
->
liveness_new_list
.
size
());
EXPECT_EQ
(
0
,
sorted
[
1
]
->
liveness_free_list
.
size
());
}
TEST
(
liveness
,
liveness
)
{
string
image
=
"liveness.png"
;
string
dump_file
=
"liveness.txt"
;
...
...
test/pass_memory_layout.cpp
View file @
886eb1ec
...
...
@@ -218,3 +218,23 @@ TEST(memory_layout, basic)
size_t
temporary_pool_size
=
pass_manager
.
get_state
().
get_temporary_pool_size
();
EXPECT_EQ
(
12
,
temporary_pool_size
);
}
TEST
(
memory_layout
,
constant
)
{
string
dump_file
=
"constant.txt"
;
pass
::
Manager
pass_manager
;
pass_manager
.
register_pass
<
pass
::
TopologicalSort
>
();
pass_manager
.
register_pass
<
pass
::
Liveness
>
();
pass_manager
.
register_pass
<
pass
::
MemoryLayout
>
();
pass_manager
.
register_pass
<
pass
::
DumpSorted
>
(
dump_file
);
auto
shape
=
Shape
{
1
};
auto
c
=
make_shared
<
op
::
Constant
>
(
element
::
i32
,
Shape
{},
"5"
);
auto
rt
=
make_shared
<
TensorViewType
>
(
element
::
Float32
::
element_type
(),
shape
);
auto
f
=
make_shared
<
Function
>
(
make_shared
<
op
::
Negative
>
(
c
),
rt
,
op
::
Parameters
{});
pass_manager
.
run_passes
(
f
);
auto
sorted
=
f
->
get_ordered_ops
();
size_t
temporary_pool_size
=
pass_manager
.
get_state
().
get_temporary_pool_size
();
EXPECT_EQ
(
0
,
temporary_pool_size
);
}
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