Browse Source

apply code-format changes

pull/5158/head
parrotsky github-actions[bot] 2 years ago
parent
commit
5edfcc0b40
2 changed files with 6 additions and 9 deletions
  1. +2
    -4
      src/layer/arm/innerproduct_arm.cpp
  2. +4
    -5
      src/layer/x86/innerproduct_x86.cpp

+ 2
- 4
src/layer/arm/innerproduct_arm.cpp View File

@@ -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)


+ 4
- 5
src/layer/x86/innerproduct_x86.cpp View File

@@ -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)


Loading…
Cancel
Save