mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Merge pull request #28467 from Sikandar1310291:fix/topk-layer-k-boundary-check-28445
Fix: TopK layer K boundary check allows K == input_dim (#28445)
This commit is contained in:
@@ -97,9 +97,9 @@ public:
|
||||
// Normalize axis
|
||||
int axis_normalized = normalize_axis(axis, input_shape.size());
|
||||
|
||||
// Check if K is in range (0, input_shape[axis])
|
||||
// Check if K is in range (0, input_shape[axis]]
|
||||
CV_CheckGT(K, 0, "TopK: K needs to be a positive integer");
|
||||
CV_CheckLT(K, input_shape[axis_normalized], "TopK: K is out of range");
|
||||
CV_CheckLE(K, input_shape[axis_normalized], "TopK: K is out of range");
|
||||
|
||||
// Assign output shape
|
||||
auto output_shape = input_shape;
|
||||
|
||||
Reference in New Issue
Block a user