Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core/Ref] Multiclass NMS: Fix vector initialization #27157

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/core/reference/src/op/multiclass_nms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ static float intersectionOverUnion(const Rectangle& boxI, const Rectangle& boxJ,
// start: start index along axis "M"
template <class T>
std::vector<T> slice_image(const T* data, const Shape& data_shape, const int64_t start, const int64_t item_num) {
std::vector<T> slice_data;
const auto class_num = data_shape[0];
const auto item_size = (data_shape.size() == 3) ? data_shape[2] : 1;

Expand All @@ -57,7 +56,7 @@ std::vector<T> slice_image(const T* data, const Shape& data_shape, const int64_t
"Invaid inputs as it is trying to slice data out of range.");

const auto row_num = item_num * item_size;
slice_data.reserve(class_num * row_num);
std::vector<T> slice_data(static_cast<size_t>(class_num * row_num));
T* item_data = slice_data.data();
T* src = const_cast<T*>(data + start * item_size);
for (size_t i = 0; i < class_num; i++) {
Expand Down
Loading