diff --git a/src/fpga/bias_scale.cpp b/src/fpga/bias_scale.cpp index 05ddf91d7a2e1f6b4b5c82444acc74f35711ba73..51c4a0ac73869c974332f37c7bae8186c28e63c3 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 7bdf5f051e494a643205692609b657e5f7615072..1936c225e10ae3e7cfdb673de14fdce791fe8d69 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 0f798a864ef7bdf08669abe525c344fdbdb39c08..6bbf34eae933d69d00517c723326111901444ab0 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 0f798a864ef7bdf08669abe525c344fdbdb39c08..6bbf34eae933d69d00517c723326111901444ab0 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. */