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
f561c937
Commit
f561c937
authored
5 years ago
by
Adam Procter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simple DynElimination test (not passing yet)
parent
d96482a5
master
v0.29.0-rc.0
v0.28.0-rc.1
v0.28.0-rc.0
v0.27.1-rc.3
v0.27.1-rc.2
v0.27.1-rc.1
v0.27.1-rc.0
v0.27.0-rc.1
v0.27.0-rc.0
v0.26.1-rc.0
v0.26.0
v0.26.0-rc.8
v0.26.0-rc.7
v0.26.0-rc.6
v0.26.0-rc.5
v0.26.0-rc.4
v0.26.0-rc.3
v0.26.0-rc.2
v0.26.0-rc.0
v0.25.1-rc.11
v0.25.1-rc.10
v0.25.1-rc.9
v0.25.1-rc.8
v0.25.1-rc.7
v0.25.1-rc.6
v0.25.1-rc.5
v0.25.1-rc.4
v0.25.1-rc.3
v0.25.1-rc.2
v0.25.1-rc.1
v0.25.1-rc.0
v0.25.0
v0.25.0-rc.3
v0.25.0-rc.2
v0.25.0-rc.1
v0.25.0-rc.0
v0.25.0-dev.0
v0.24.0
v0.24.0-rc.3
v0.24.0-rc.2
v0.24.0-rc.1
v0.24.0-rc.0
v0.20.0-rc.2
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
dyn_elimination.cpp
test/dyn_elimination.cpp
+47
-0
No files found.
test/dyn_elimination.cpp
View file @
f561c937
...
...
@@ -84,3 +84,50 @@ TEST(dyn_elimination, transpose_dyn_shape)
ASSERT_TRUE
(
new_transpose
->
get_output_partial_shape
(
0
).
relaxes
(
PartialShape
{
Dimension
::
dynamic
(),
8
,
4
,
2
}));
}
TEST
(
dyn_elimination
,
slice
)
{
// input has shape [2,4,6,8,2,2,2]
// slice in numpy syntax is [0:,:4,2:6:2,7:3:-2,np.newaxis,...,1]
// shape should be [2,4,2,2,1,2,2] (so sayeth numpy!)
Shape
shape_in
{
2
,
4
,
6
,
8
,
2
,
2
,
2
};
auto
input
=
make_shared
<
op
::
Parameter
>
(
element
::
f32
,
shape_in
);
auto
constant_lb
=
make_shared
<
op
::
Constant
>
(
element
::
i64
,
Shape
{
7
},
vector
<
int64_t
>
{
0
,
3
,
2
,
7
,
0
,
0
,
1
});
auto
constant_ub
=
make_shared
<
op
::
Constant
>
(
element
::
i64
,
Shape
{
7
},
vector
<
int64_t
>
{
0
,
4
,
6
,
3
,
0
,
0
,
0
});
auto
constant_strides
=
make_shared
<
op
::
Constant
>
(
element
::
i64
,
Shape
{
7
},
vector
<
int64_t
>
{
1
,
1
,
2
,
-
2
,
0
,
0
,
0
});
AxisSet
lower_bounds_mask
{
1
};
AxisSet
upper_bounds_mask
{
0
};
AxisSet
new_axis_mask
{
4
};
AxisSet
shrink_mask
{
6
};
AxisSet
ellipsis_mask
{
5
};
auto
sl
=
make_shared
<
op
::
DynSlice
>
(
input
,
constant_lb
,
constant_ub
,
constant_strides
,
lower_bounds_mask
,
upper_bounds_mask
,
new_axis_mask
,
shrink_mask
,
ellipsis_mask
);
ASSERT_EQ
(
sl
->
get_element_type
(),
element
::
f32
);
ASSERT_EQ
(
sl
->
get_shape
(),
(
Shape
{
2
,
4
,
2
,
2
,
1
,
2
,
2
}));
auto
f
=
make_shared
<
Function
>
(
sl
,
ParameterVector
{
input
});
pass
::
Manager
pass_manager
;
pass_manager
.
register_pass
<
pass
::
DynElimination
>
();
pass_manager
.
run_passes
(
f
);
ASSERT_EQ
(
count_ops_of_type
<
op
::
DynSlice
>
(
f
),
0
);
ASSERT_EQ
(
count_ops_of_type
<
op
::
Slice
>
(
f
),
1
);
ASSERT_EQ
(
count_ops_of_type
<
op
::
Reshape
>
(
f
),
1
);
ASSERT_EQ
(
count_ops_of_type
<
op
::
Reverse
>
(
f
),
1
);
ASSERT_EQ
(
f
->
get_results
().
at
(
0
)
->
get_element_type
(),
element
::
f32
);
ASSERT_EQ
(
f
->
get_results
().
at
(
0
)
->
get_shape
(),
(
Shape
{
2
,
4
,
2
,
2
,
1
,
2
,
2
}));
}
This diff is collapsed.
Click to expand it.
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