[Fix] ncnn [-Wreturn-type] and improve mutex if (#431)

* Fix make ncnn [-Wreturn-type]

* Fix lint
This commit is contained in:
HinGwenWoong 2022-05-07 10:35:22 +08:00 committed by GitHub
parent 59453dc0f6
commit 76f6e253bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 14 deletions

View File

@ -29,8 +29,7 @@ int ConstantOfShape::forward(const Mat& bottom_blob, Mat& top_blob, const Option
if (top_blob.empty()) return -100;
top_blob.fill(val);
return 0;
}
if (dims == 2) {
} else if (dims == 2) {
int h = (int)(shape_ptr[0] + 0.5);
int w = (int)(shape_ptr[1] + 0.5);
size_t elemsize = sizeof(val);
@ -38,8 +37,7 @@ int ConstantOfShape::forward(const Mat& bottom_blob, Mat& top_blob, const Option
if (top_blob.empty()) return -100;
top_blob.fill(val);
return 0;
}
if (dims == 3) {
} else if (dims == 3) {
int channels = (int)(shape_ptr[0] + 0.5);
int h = (int)(shape_ptr[1] + 0.5);
int w = (int)(shape_ptr[2] + 0.5);
@ -49,6 +47,7 @@ int ConstantOfShape::forward(const Mat& bottom_blob, Mat& top_blob, const Option
top_blob.fill(val);
return 0;
}
return -1;
}
} // namespace mmdeploy

View File

@ -46,8 +46,7 @@ int Expand::forward(const std::vector<Mat>& bottom_blobs, std::vector<Mat>& top_
return -100;
}
return 0;
}
if (bottom_blob.dims == 1 && shape_blob.w == 2) {
} else if (bottom_blob.dims == 1 && shape_blob.w == 2) {
int shape_0 = (int)(shape_blob[0] + 0.5);
int shape_1 = (int)(shape_blob[1] + 0.5);
if (bottom_blob.w != shape_1 && bottom_blob.w != 1 && shape_1 != 1) {
@ -78,8 +77,7 @@ int Expand::forward(const std::vector<Mat>& bottom_blobs, std::vector<Mat>& top_
return -100;
}
return 0;
}
if (bottom_blob.dims == 1 && shape_blob.w == 3) {
} else if (bottom_blob.dims == 1 && shape_blob.w == 3) {
int shape_0 = (int)(shape_blob[0] + 0.5);
int shape_1 = (int)(shape_blob[1] + 0.5);
int shape_2 = (int)(shape_blob[2] + 0.5);
@ -112,8 +110,7 @@ int Expand::forward(const std::vector<Mat>& bottom_blobs, std::vector<Mat>& top_
return -100;
}
return 0;
}
if (bottom_blob.dims == 2 && shape_blob.w == 2) {
} else if (bottom_blob.dims == 2 && shape_blob.w == 2) {
int shape_0 = (int)(shape_blob[0] + 0.5);
int shape_1 = (int)(shape_blob[1] + 0.5);
if (bottom_blob.w != shape_1 && bottom_blob.w != 1 && shape_1 != 1) {
@ -160,8 +157,7 @@ int Expand::forward(const std::vector<Mat>& bottom_blobs, std::vector<Mat>& top_
return -100;
}
return 0;
}
if (bottom_blob.dims == 2 && shape_blob.w == 3) {
} else if (bottom_blob.dims == 2 && shape_blob.w == 3) {
int shape_0 = (int)(shape_blob[0] + 0.5);
int shape_1 = (int)(shape_blob[1] + 0.5);
int shape_2 = (int)(shape_blob[2] + 0.5);
@ -219,8 +215,7 @@ int Expand::forward(const std::vector<Mat>& bottom_blobs, std::vector<Mat>& top_
return -100;
}
return 0;
}
if (bottom_blob.dims == 3 && shape_blob.w == 3) {
} else if (bottom_blob.dims == 3 && shape_blob.w == 3) {
int shape_0 = (int)(shape_blob[0] + 0.5);
int shape_1 = (int)(shape_blob[1] + 0.5);
int shape_2 = (int)(shape_blob[2] + 0.5);
@ -332,6 +327,7 @@ int Expand::forward(const std::vector<Mat>& bottom_blobs, std::vector<Mat>& top_
}
fprintf(stderr, "Layer: Expand, bottom_blob.dims: %d, shape_blob.w: %d\n", bottom_blob.dims,
shape_blob.w);
return -1;
}
} // namespace mmdeploy