mirror of
https://github.com/opencv/opencv.git
synced 2025-06-08 01:53:19 +08:00
Merge pull request #23287 from alalek:dnn_tflite_fix_illegal_access
This commit is contained in:
commit
b3c9842a98
@ -497,9 +497,8 @@ void TFLiteImporter::parseConcat(const Operator& op, const std::string& opcode,
|
|||||||
DataLayout inpLayout = layouts[op.inputs()->Get(0)];
|
DataLayout inpLayout = layouts[op.inputs()->Get(0)];
|
||||||
if (inpLayout == DATA_LAYOUT_NHWC) {
|
if (inpLayout == DATA_LAYOUT_NHWC) {
|
||||||
// OpenCV works in NCHW data layout. So change the axis correspondingly.
|
// OpenCV works in NCHW data layout. So change the axis correspondingly.
|
||||||
CV_Check(axis, -4 < axis && axis < 4, "");
|
axis = normalize_axis(axis, 4);
|
||||||
int remap[] = {0, 2, 3, 1};
|
static const int remap[] = {0, 2, 3, 1};
|
||||||
axis = axis > 0 ? axis : 4 + axis;
|
|
||||||
axis = remap[axis];
|
axis = remap[axis];
|
||||||
}
|
}
|
||||||
layerParams.set("axis", axis);
|
layerParams.set("axis", axis);
|
||||||
|
Loading…
Reference in New Issue
Block a user