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
dc4a2143
Commit
dc4a2143
authored
Jun 07, 2019
by
Adam Procter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A few more tests for the negative-stride slicing issue that's worrying me.
parent
dbdc25c8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
dyn_slice_test.in.cpp
test/dyn_slice_test.in.cpp
+0
-0
generate_dyn_slice_ref.py
test/ref_generators/generate_dyn_slice_ref.py
+43
-0
No files found.
test/dyn_slice_test.in.cpp
View file @
dc4a2143
This diff is collapsed.
Click to expand it.
test/ref_generators/generate_dyn_slice_ref.py
View file @
dc4a2143
...
...
@@ -439,6 +439,49 @@ NGRAPH_TEST(${BACKEND_NAME}, dyn_slice)
t
[
3
:
2
:
1
]
t
[
4
::
-
2
]
#
# A couple of tests for negative-stride slicing. The issue we want to
# be on the lookout for is this:
#
# 01234567
# ..1..0.. [5:0:-3] # suppose we start with this, want to convert
# _____ # to pos stride. suppose that our stride is
# # "uneven" wrt the slicing region, i.e. the
# # start-to-end distance is not an even
# # multiple of the strides (e.g. here: we get
# # elements 5 and 2.)
#
# 01234567
# .0..1... [1:6:3] # if we just reverse the sign of the stride
# _____ # and flip the start/end indices while
# # traversing, we will get out the wrong
# # elements. (e.g. here: we get elements 1 and
# # 4, which are not what we want.)
#
# 01234567
# ..0..1.. [2:6:3] # the correct thing to do is to adjust the
# ____ # start of our reversed slice to be the last
# # element that is *actually* touched by the
# # original negative striding, not the
# # boundary of the region. (e.g. here: we get
# # elements 2 and 5, which are what we want.)
#
# There's some logic to do this transformation in DynElimination, but
# it feels a bit delicate.
#
t
.
set_shape
((
8
,))
t
[
5
:
2
:
-
3
]
t
[
5
:
1
:
-
3
]
t
[
5
:
0
:
-
3
]
t
[
5
::
-
3
]
t
[
6
:
3
:
-
3
]
t
[
6
:
2
:
-
3
]
t
[
6
:
1
:
-
3
]
t
[
6
::
-
3
]
t
[
7
:
1
:
-
3
]
t
[
7
:
0
:
-
3
]
t
[
7
::
-
3
]
t
.
set_dtype
(
'int32'
)
t
[
80000
]
# error expected (shrink-axis OOB)
t
[
-
80000
]
# error expected (shrink-axis OOB)
...
...
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