mirror of
https://github.com/open-mmlab/mmdeploy.git
synced 2025-01-14 08:09:43 +08:00
[Fix] ncnn [-Wreturn-type] and improve mutex if
(#431)
* Fix make ncnn [-Wreturn-type] * Fix lint
This commit is contained in:
parent
59453dc0f6
commit
76f6e253bb
@ -29,8 +29,7 @@ int ConstantOfShape::forward(const Mat& bottom_blob, Mat& top_blob, const Option
|
|||||||
if (top_blob.empty()) return -100;
|
if (top_blob.empty()) return -100;
|
||||||
top_blob.fill(val);
|
top_blob.fill(val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (dims == 2) {
|
||||||
if (dims == 2) {
|
|
||||||
int h = (int)(shape_ptr[0] + 0.5);
|
int h = (int)(shape_ptr[0] + 0.5);
|
||||||
int w = (int)(shape_ptr[1] + 0.5);
|
int w = (int)(shape_ptr[1] + 0.5);
|
||||||
size_t elemsize = sizeof(val);
|
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;
|
if (top_blob.empty()) return -100;
|
||||||
top_blob.fill(val);
|
top_blob.fill(val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (dims == 3) {
|
||||||
if (dims == 3) {
|
|
||||||
int channels = (int)(shape_ptr[0] + 0.5);
|
int channels = (int)(shape_ptr[0] + 0.5);
|
||||||
int h = (int)(shape_ptr[1] + 0.5);
|
int h = (int)(shape_ptr[1] + 0.5);
|
||||||
int w = (int)(shape_ptr[2] + 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);
|
top_blob.fill(val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mmdeploy
|
} // namespace mmdeploy
|
||||||
|
@ -46,8 +46,7 @@ int Expand::forward(const std::vector<Mat>& bottom_blobs, std::vector<Mat>& top_
|
|||||||
return -100;
|
return -100;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (bottom_blob.dims == 1 && shape_blob.w == 2) {
|
||||||
if (bottom_blob.dims == 1 && shape_blob.w == 2) {
|
|
||||||
int shape_0 = (int)(shape_blob[0] + 0.5);
|
int shape_0 = (int)(shape_blob[0] + 0.5);
|
||||||
int shape_1 = (int)(shape_blob[1] + 0.5);
|
int shape_1 = (int)(shape_blob[1] + 0.5);
|
||||||
if (bottom_blob.w != shape_1 && bottom_blob.w != 1 && shape_1 != 1) {
|
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 -100;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (bottom_blob.dims == 1 && shape_blob.w == 3) {
|
||||||
if (bottom_blob.dims == 1 && shape_blob.w == 3) {
|
|
||||||
int shape_0 = (int)(shape_blob[0] + 0.5);
|
int shape_0 = (int)(shape_blob[0] + 0.5);
|
||||||
int shape_1 = (int)(shape_blob[1] + 0.5);
|
int shape_1 = (int)(shape_blob[1] + 0.5);
|
||||||
int shape_2 = (int)(shape_blob[2] + 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 -100;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (bottom_blob.dims == 2 && shape_blob.w == 2) {
|
||||||
if (bottom_blob.dims == 2 && shape_blob.w == 2) {
|
|
||||||
int shape_0 = (int)(shape_blob[0] + 0.5);
|
int shape_0 = (int)(shape_blob[0] + 0.5);
|
||||||
int shape_1 = (int)(shape_blob[1] + 0.5);
|
int shape_1 = (int)(shape_blob[1] + 0.5);
|
||||||
if (bottom_blob.w != shape_1 && bottom_blob.w != 1 && shape_1 != 1) {
|
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 -100;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (bottom_blob.dims == 2 && shape_blob.w == 3) {
|
||||||
if (bottom_blob.dims == 2 && shape_blob.w == 3) {
|
|
||||||
int shape_0 = (int)(shape_blob[0] + 0.5);
|
int shape_0 = (int)(shape_blob[0] + 0.5);
|
||||||
int shape_1 = (int)(shape_blob[1] + 0.5);
|
int shape_1 = (int)(shape_blob[1] + 0.5);
|
||||||
int shape_2 = (int)(shape_blob[2] + 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 -100;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (bottom_blob.dims == 3 && shape_blob.w == 3) {
|
||||||
if (bottom_blob.dims == 3 && shape_blob.w == 3) {
|
|
||||||
int shape_0 = (int)(shape_blob[0] + 0.5);
|
int shape_0 = (int)(shape_blob[0] + 0.5);
|
||||||
int shape_1 = (int)(shape_blob[1] + 0.5);
|
int shape_1 = (int)(shape_blob[1] + 0.5);
|
||||||
int shape_2 = (int)(shape_blob[2] + 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,
|
fprintf(stderr, "Layer: Expand, bottom_blob.dims: %d, shape_blob.w: %d\n", bottom_blob.dims,
|
||||||
shape_blob.w);
|
shape_blob.w);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mmdeploy
|
} // namespace mmdeploy
|
||||||
|
Loading…
x
Reference in New Issue
Block a user