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
85582d0c
Commit
85582d0c
authored
Jun 12, 2019
by
Adam Procter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moar tests
parent
c99d65a0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
23 deletions
+33
-23
dyn_replace_slice.cpp
src/ngraph/op/experimental/dyn_replace_slice.cpp
+33
-22
validation_util.cpp
src/ngraph/validation_util.cpp
+0
-1
type_prop.cpp
test/type_prop.cpp
+0
-0
No files found.
src/ngraph/op/experimental/dyn_replace_slice.cpp
View file @
85582d0c
...
...
@@ -91,6 +91,17 @@ void op::DynReplaceSlice::validate_and_infer_types()
strides_shape
.
rank
(),
"."
);
PartialShape
attrs_shape
{
PartialShape
::
dynamic
()};
NODE_VALIDATION_CHECK
(
this
,
(
lower_bounds_shape
.
same_scheme
(
PartialShape
{
0
})
||
PartialShape
::
merge_into
(
attrs_shape
,
lower_bounds_shape
))
&&
(
upper_bounds_shape
.
same_scheme
(
PartialShape
{
0
})
||
PartialShape
::
merge_into
(
attrs_shape
,
upper_bounds_shape
))
&&
(
strides_shape
.
same_scheme
(
PartialShape
{
0
})
||
PartialShape
::
merge_into
(
attrs_shape
,
strides_shape
)),
"Shapes for lower bounds, upper bounds, and strides do not match"
);
set_input_is_relevant_to_shape
(
2
);
set_input_is_relevant_to_shape
(
3
);
set_input_is_relevant_to_shape
(
4
);
...
...
@@ -99,32 +110,32 @@ void op::DynReplaceSlice::validate_and_infer_types()
auto
upper_bounds
=
dynamic_pointer_cast
<
op
::
Constant
>
(
get_argument
(
3
));
auto
strides
=
dynamic_pointer_cast
<
op
::
Constant
>
(
get_argument
(
4
));
// TODO(amprocte): We can get a bit more information here about the ranks of arg and
// replacement by inspecting the attributes.
auto
slice_shape
=
PartialShape
::
dynamic
();
if
(
lower_bounds
&&
upper_bounds
&&
strides
)
{
auto
inferred_slice_shape
=
infer_slice_shape
(
this
,
get_input_partial_shape
(
0
),
lower_bounds
->
get_vector
<
int64_t
>
(),
upper_bounds
->
get_vector
<
int64_t
>
(),
strides
->
get_vector
<
int64_t
>
(),
m_lower_bounds_mask
,
m_upper_bounds_mask
,
m_new_axis
,
m_shrink_axis
,
m_ellipsis_mask
);
NODE_VALIDATION_CHECK
(
this
,
replacement_shape
.
compatible
(
inferred_slice_shape
),
"Shape of the replacement is not compatible with the shape of the "
"slice (shape of slice: "
,
inferred_slice_shape
,
")"
);
slice_shape
=
infer_slice_shape
(
this
,
get_input_partial_shape
(
0
),
lower_bounds
->
get_vector
<
int64_t
>
(),
upper_bounds
->
get_vector
<
int64_t
>
(),
strides
->
get_vector
<
int64_t
>
(),
m_lower_bounds_mask
,
m_upper_bounds_mask
,
m_new_axis
,
m_shrink_axis
,
m_ellipsis_mask
);
}
PartialShape
output_shape
=
arg_shape
;
NODE_VALIDATION_CHECK
(
this
,
PartialShape
::
merge_into
(
output_shape
,
PartialShape
::
dynamic
(
replacement_shape
.
rank
())),
"Rank of the replacement is not compatible with rank of the argument tensor"
);
set_output_type
(
0
,
get_input_element_type
(
0
),
output_shape
);
NODE_VALIDATION_CHECK
(
this
,
slice_shape
.
compatible
(
replacement_shape
),
"Shape of the replacement is not compatible with the shape of the "
"slice (shape of slice: "
,
slice_shape
,
")"
);
set_output_type
(
0
,
result_et
,
arg_shape
);
}
shared_ptr
<
Node
>
op
::
DynReplaceSlice
::
copy_with_new_args
(
const
NodeVector
&
new_args
)
const
...
...
src/ngraph/validation_util.cpp
View file @
85582d0c
...
...
@@ -626,7 +626,6 @@ PartialShape ngraph::infer_slice_shape(const Node* node,
const
AxisSet
&
shrink_axis
,
const
AxisSet
&
ellipsis_mask
)
{
// TODO(amprocte): double-check that these checks are needed.
if
(
lb
.
size
()
&&
ub
.
size
())
{
NODE_VALIDATION_CHECK
(
node
,
...
...
test/type_prop.cpp
View file @
85582d0c
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