未验证 提交 14abff89 编写于 作者: W wanghuancoder 提交者: GitHub

fix strided slice compute bug (#56428)

* fix strided slice compute bug
上级 704303ca
......@@ -57,14 +57,17 @@ void StridedSliceRawStridedKernel(const Context& dev_ctx,
}
}
}
int64_t left = 0;
int64_t right = 0;
if (strides[i] < 0) {
starts[i] = starts[i] + 1;
ends[i] = ends[i] + 1;
left = std::max(static_cast<int64_t>(-1), ends[i]);
right = std::min(axis_size - 1, starts[i]);
} else {
left = std::max(static_cast<int64_t>(0), starts[i]);
right = std::min(axis_size, ends[i]);
}
int64_t left =
std::max(static_cast<int64_t>(0), std::min(starts[i], ends[i]));
int64_t right = std::min(axis_size, std::max(starts[i], ends[i]));
int64_t step = std::abs(strides[i]);
auto dim = (std::abs(right - left) + step - 1) / step;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册