From 5edfcc0b40d167c83dc8d3fce64687989cd02de6 Mon Sep 17 00:00:00 2001 From: parrotsky Date: Thu, 4 Apr 2024 23:08:44 +0000 Subject: [PATCH] apply code-format changes --- src/layer/arm/innerproduct_arm.cpp | 6 ++---- src/layer/x86/innerproduct_x86.cpp | 9 ++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/layer/arm/innerproduct_arm.cpp b/src/layer/arm/innerproduct_arm.cpp index 65e1b04af..da27bb1da 100644 --- a/src/layer/arm/innerproduct_arm.cpp +++ b/src/layer/arm/innerproduct_arm.cpp @@ -406,7 +406,7 @@ int InnerProduct_arm::forward(const Mat& bottom_blob, Mat& top_blob, const Optio return 0; } - if (bottom_blob.dims == 3 && bottom_blob.c == num_input) + if (bottom_blob.dims == 3 && bottom_blob.c == num_input) { // 3d tensor input gemm int w = bottom_blob.w; @@ -414,7 +414,7 @@ int InnerProduct_arm::forward(const Mat& bottom_blob, Mat& top_blob, const Optio int c = bottom_blob.c; // num_input size_t elemsize = bottom_blob.elemsize; int elempack = bottom_blob.elempack; - ncnn::Mat bottom_blob_flattened = bottom_blob.reshape( c, w * h); + ncnn::Mat bottom_blob_flattened = bottom_blob.reshape(c, w * h); top_blob.create(num_output, w * h, elemsize, elempack, opt.blob_allocator); if (top_blob.empty()) @@ -640,9 +640,7 @@ int InnerProduct_arm::forward(const Mat& bottom_blob, Mat& top_blob, const Optio top_blob = top_blob.reshape(w, h, num_output); return 0; } - - // flatten Mat bottom_blob_flattened = bottom_blob; if (bottom_blob.dims != 1) diff --git a/src/layer/x86/innerproduct_x86.cpp b/src/layer/x86/innerproduct_x86.cpp index e2d1e776b..f29295456 100644 --- a/src/layer/x86/innerproduct_x86.cpp +++ b/src/layer/x86/innerproduct_x86.cpp @@ -130,23 +130,23 @@ int InnerProduct_x86::forward(const Mat& bottom_blob, Mat& top_blob, const Optio return 0; } - + if (bottom_blob.dims == 3 && bottom_blob.c == num_input) { - // 3d input vector + // 3d input vector int w = bottom_blob.w; int h = bottom_blob.h; int c = bottom_blob.c; // num_input size_t elemsize = bottom_blob.elemsize; int elempack = bottom_blob.elempack; - ncnn::Mat bottom_blob_flattened = bottom_blob.reshape(c, w*h ); + ncnn::Mat bottom_blob_flattened = bottom_blob.reshape(c, w * h); ncnn::Mat top_blob_flattened; // Adjust the size of top_blob top_blob.create(num_output, h * w, elemsize, elempack, opt.blob_allocator); if (top_blob.empty()) - return -100; + return -100; // Perform the matrix multiplication innerproduct_gemm_sse(bottom_blob_flattened, top_blob, weight_data_tm, bias_data, activation_type, activation_params, opt); @@ -154,7 +154,6 @@ int InnerProduct_x86::forward(const Mat& bottom_blob, Mat& top_blob, const Optio return 0; } - // flatten Mat bottom_blob_flattened = bottom_blob; if (bottom_blob.dims != 1)