Skip to content

Commit cb67727

Browse files
Requested change
1 parent 5d2a571 commit cb67727

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/net.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,12 +2206,20 @@ int Extractor::input(int blob_index, const Mat& in)
22062206
if (blob_index < 0 || blob_index >= (int)d->blob_mats.size())
22072207
return -1;
22082208

2209-
Mat shape = d->net->blobs()[blob_index].shape;
2210-
if (shape.total() && (shape.w != in.w) && (shape.h != in.h) && (shape.d != in.d) && (shape.c != in.c))
2211-
return -1;
2209+
const Mat& shape = d->net->blobs()[blob_index].shape;
2210+
if (shape.total())
2211+
{
2212+
if ((in.dims == 3 || in.dims == 4) && (shape.w != in.w || shape.h != in.h || shape.d != in.d || shape.c != in.c * in.elempack))
2213+
return -1;
22122214

2213-
d->blob_mats[blob_index] = in;
2215+
if (in.dims == 2 && (shape.w != in.w || shape.h != in.h * in.elempack))
2216+
return -1;
2217+
2218+
if (in.dims == 1 && (shape.w != in.w * in.elempack))
2219+
return -1;
2220+
}
22142221

2222+
d->blob_mats[blob_index] = in;
22152223
return 0;
22162224
}
22172225

0 commit comments

Comments
 (0)