Skip to content

Commit b3c9842

Browse files
committed
Merge pull request opencv#23287 from alalek:dnn_tflite_fix_illegal_access
2 parents 5a22735 + 9eb5e39 commit b3c9842

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

modules/dnn/src/tflite/tflite_importer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,8 @@ void TFLiteImporter::parseConcat(const Operator& op, const std::string& opcode,
497497
DataLayout inpLayout = layouts[op.inputs()->Get(0)];
498498
if (inpLayout == DATA_LAYOUT_NHWC) {
499499
// OpenCV works in NCHW data layout. So change the axis correspondingly.
500-
CV_Check(axis, -4 < axis && axis < 4, "");
501-
int remap[] = {0, 2, 3, 1};
502-
axis = axis > 0 ? axis : 4 + axis;
500+
axis = normalize_axis(axis, 4);
501+
static const int remap[] = {0, 2, 3, 1};
503502
axis = remap[axis];
504503
}
505504
layerParams.set("axis", axis);

0 commit comments

Comments
 (0)