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

[Feature](bangc-ops): add maximum input size check for box_iou_rotated. #850

Merged
merged 1 commit into from
Oct 11, 2023
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
7 changes: 7 additions & 0 deletions bangc-ops/kernels/box_iou_rotated/box_iou_rotated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

// each box data contains 5 number: x, y, w, h, a
#define SINGLE_BOX_DIM 5
#define MAX_BOX_NUM 10000000

static void policyFunc(const mluOpHandle_t handle, cnrtDim3_t *k_dim,
cnrtFunctionType_t *k_type, const bool aligned,
Expand Down Expand Up @@ -148,6 +149,12 @@ mluOpBoxIouRotated(mluOpHandle_t handle, const int mode, const bool aligned,
<< ", box2_desc->dims[0] is " << box2_desc->dims[0] << ".";
return MLUOP_STATUS_BAD_PARAM;
}
if (box1_desc->dims[0] > MAX_BOX_NUM) {
LOG(ERROR) << "[mluOpBoxIouRotated] Check failed: If it is aligned mode, "
<< "box1_desc->dims[0] should less than or equal to "
<< "10,000,000. But now is " << box1_desc->dims[0] << ".";
return MLUOP_STATUS_BAD_PARAM;
}
} else {
if (ious_desc->dim != 2) {
LOG(ERROR)
Expand Down