Commit 630bd1ab authored by Adam Procter's avatar Adam Procter

Fix a couple more bugs, add a bunch of unit tests

parent 1af4d95a
...@@ -265,7 +265,8 @@ static SlicePlan make_plan(const Shape& input_shape, ...@@ -265,7 +265,8 @@ static SlicePlan make_plan(const Shape& input_shape,
int64_t min_real_end = (is_reverse ? -1 : 0); int64_t min_real_end = (is_reverse ? -1 : 0);
real_end = std::max(min_real_end, std::min(int64_t(input_shape[i_in]), real_end)); real_end = std::max(min_real_end, std::min(int64_t(input_shape[i_in]), real_end));
// Adjust the stride for backwards slicing. // Ensure stride is not zero, and adjust it for backwards slicing.
NGRAPH_CHECK(strides[i] != 0);
int64_t real_stride = std::abs(strides[i]); int64_t real_stride = std::abs(strides[i]);
// Adjust for reversal if needed. This isn't quite as simple as swapping begin and // Adjust for reversal if needed. This isn't quite as simple as swapping begin and
...@@ -281,6 +282,13 @@ static SlicePlan make_plan(const Shape& input_shape, ...@@ -281,6 +282,13 @@ static SlicePlan make_plan(const Shape& input_shape,
p.reverse_axes.insert(i_out); p.reverse_axes.insert(i_out);
} }
// nGraph's slice op does not like it when end < begin, so we truncate for that case
// here.
if (real_end < real_begin)
{
real_end = real_begin;
}
// Compute output dimension. // Compute output dimension.
size_t dim = (real_end <= real_begin size_t dim = (real_end <= real_begin
? 0 ? 0
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment