Commit 7ad4d5c1 authored by Adam Rogowiec's avatar Adam Rogowiec Committed by Scott Cyphers

Handle slice start past the end case. (#3157)

parent 358efff9
......@@ -18,6 +18,7 @@
#include <memory>
#include <vector>
#include "ngraph/log.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/slice.hpp"
#include "slice.hpp"
......@@ -59,6 +60,15 @@ namespace ngraph
get_valid_array_idx(ends.at(idx), data_shape.at(axis));
}
// Check for cases when start is greater than end and change them to "empty" slice.
for (auto idx = 0; idx < lower_bounds.size(); ++idx)
{
if (lower_bounds.at(idx) > upper_bounds.at(idx))
{
upper_bounds.at(idx) = lower_bounds.at(idx);
}
}
return {std::make_shared<ngraph::op::Slice>(data, lower_bounds, upper_bounds)};
}
......
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