From 15d4872ba25c5026d903a8caface4fb0d5003783 Mon Sep 17 00:00:00 2001 From: zhangyang Date: Mon, 3 Sep 2018 11:31:40 +0800 Subject: [PATCH] format code --- src/fpga/bias_scale.cpp | 89 ++++++++++++++++++++++------------------- src/fpga/bias_scale.h | 10 ++--- src/fpga/filter.cpp | 51 +++++++---------------- src/fpga/filter.h | 33 +++++++-------- src/fpga/image.cpp | 2 +- src/fpga/image.h | 2 +- 6 files changed, 85 insertions(+), 102 deletions(-) diff --git a/src/fpga/bias_scale.cpp b/src/fpga/bias_scale.cpp index 05ddf91d7a..51c4a0ac73 100644 --- a/src/fpga/bias_scale.cpp +++ b/src/fpga/bias_scale.cpp @@ -12,49 +12,54 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include #include "bias_scale.h" +#include #include "api.h" - namespace paddle_mobile { - namespace fpga { - namespace bias_scale{ - - void align_element(float** data_in, int num_per_div_before_alignment, int num){ - float *ptr_unaligned = *data_in; - int div_num = (num + num_per_div_before_alignment -1) / num_per_div_before_alignment; - int num_per_div_after_alignment = align_to_x(num_per_div_before_alignment, BS_NUM_ALIGNMENT); - int num_element = 2 * div_num * num_per_div_after_alignment; //including bias & scale - float *ptr_aligned = (float*) fpga_malloc(num_element * sizeof(float)); - - memset(ptr_aligned, 0, num_element * sizeof(float)); - - - for(int i =0; i #include "filter.h" +#include #include "api.h" namespace paddle_mobile { - namespace fpga { - namespace filter{ - - void convert_to_hwc(float** data_in, int num, int channel, int height, int width){ - - } - - - float find_max(float* data_in, int num){ - - return 0; - - - } - - - void quantize(float* data_in, int num){ - - } - - - void align_element(float** data_in, int num, int chw){ - - } - - - void align_num(float** data_in, int num_per_div_before_alignment, int num, int chw){ +namespace fpga { +namespace filter { - } +void convert_to_hwc(float** data_in, int num, int channel, int height, + int width) {} +float find_max(float* data_in, int num) { return 0; } - void reorder(float** data_in, int num_after_alignment, int chw){ +void quantize(float* data_in, int num) {} - } +void align_element(float** data_in, int num, int chw) {} +void align_num(float** data_in, int num_per_div_before_alignment, int num, + int chw) {} - void interleave(float** data_in, int num_after_alignment, int chw){ +void reorder(float** data_in, int num_after_alignment, int chw) {} - } +void interleave(float** data_in, int num_after_alignment, int chw) {} - } // namespace filter - } // namespace fpga -} // namespace paddle_mobile \ No newline at end of file +} // namespace filter +} // namespace fpga +} // namespace paddle_mobile diff --git a/src/fpga/filter.h b/src/fpga/filter.h index 7bdf5f051e..1936c225e1 100644 --- a/src/fpga/filter.h +++ b/src/fpga/filter.h @@ -14,21 +14,22 @@ limitations under the License. */ #pragma once - -#define FILTER_NUM_ALIGNMENT 32 //Filter number aligned to 32 -#define FILTER_ELEMENT_ALIGNMENT 16 //Filter element number aligned to 16 +#define FILTER_NUM_ALIGNMENT 32 // Filter number aligned to 32 +#define FILTER_ELEMENT_ALIGNMENT 16 // Filter element number aligned to 16 namespace paddle_mobile { - namespace fpga { - namespace filter{ - void convert_to_hwc(float** data_in, int num, int channel, int height, int width); - float find_max(float* data_in, int num); - void quantize(float* data_in, int num); - void align_element(float** data_in, int num, int chw); - void align_num(float** data_in, int num_per_div_before_alignment, int num, int chw); - void reorder(float** data_in, int num_after_alignment, int chw); - void interleave(float** data_in, int num_after_alignment, int chw); - - } // namespace filter - } // namespace fpga -} // namespace paddle_mobile \ No newline at end of file +namespace fpga { +namespace filter { +void convert_to_hwc(float** data_in, int num, int channel, int height, + int width); +float find_max(float* data_in, int num); +void quantize(float* data_in, int num); +void align_element(float** data_in, int num, int chw); +void align_num(float** data_in, int num_per_div_before_alignment, int num, + int chw); +void reorder(float** data_in, int num_after_alignment, int chw); +void interleave(float** data_in, int num_after_alignment, int chw); + +} // namespace filter +} // namespace fpga +} // namespace paddle_mobile diff --git a/src/fpga/image.cpp b/src/fpga/image.cpp index 0f798a864e..6bbf34eae9 100644 --- a/src/fpga/image.cpp +++ b/src/fpga/image.cpp @@ -10,4 +10,4 @@ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -limitations under the License. */ \ No newline at end of file +limitations under the License. */ diff --git a/src/fpga/image.h b/src/fpga/image.h index 0f798a864e..6bbf34eae9 100644 --- a/src/fpga/image.h +++ b/src/fpga/image.h @@ -10,4 +10,4 @@ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -limitations under the License. */ \ No newline at end of file +limitations under the License. */ -- GitLab