diff --git a/src/fpga/V2/api.cpp b/src/fpga/V2/api.cpp index 5bfd34104600668ce63a9c7d684d4482d5d804fb..d58e780c279e03b90b4ebe3731c6693615107ec4 100644 --- a/src/fpga/V2/api.cpp +++ b/src/fpga/V2/api.cpp @@ -132,11 +132,11 @@ void format_concat_output(framework::Tensor *out, int height, int width, } int format_conv_data(framework::Tensor *filter_tensor, - framework::Tensor *ofm_tensor, float *bs_ptr, int group) { + framework::Tensor *ofm_tensor, float **bs_ptr, int group) { float max_value = fpga::filter_find_max(filter_tensor); fpga::format_filter(filter_tensor, max_value, group); int aligned_num = get_aligned_filter_num(filter_tensor); - fpga::format_bias_scale_array(&bs_ptr, + fpga::format_bias_scale_array(bs_ptr, (int)filter_tensor->dims()[0], // NOLINT aligned_num); int aligned_channel = fpga::get_conv_output_channel(filter_tensor); diff --git a/src/fpga/V2/api.h b/src/fpga/V2/api.h index 1386810164d72ef849162b76a8b83fcf32082907..59c1b006183e4355ebe9316766773215b6edf12f 100644 --- a/src/fpga/V2/api.h +++ b/src/fpga/V2/api.h @@ -39,7 +39,7 @@ void format_bias_scale_array(float** bias_scale_array, int filter_num, void format_concat_output(framework::Tensor* out, int height, int width, uint32_t out_channel); int format_conv_data(framework::Tensor* filter_tensor, - framework::Tensor* ofm_tensor, float* bs_ptr, int group); + framework::Tensor* ofm_tensor, float** bs_ptr, int group); int format_fc_data(framework::Tensor* filter_tensor, framework::Tensor* ofm_tensor, float* bs_ptr); void fill_split_arg(struct SplitConvArgs* arg, framework::Tensor* input, diff --git a/src/operators/kernel/fpga/V2/conv_add_bn_kernel.cpp b/src/operators/kernel/fpga/V2/conv_add_bn_kernel.cpp index 7c03daf7797dbc09ba85a4f4e32e983571d192df..82cb872055aed84d28c798e413b86478de6ca0a6 100644 --- a/src/operators/kernel/fpga/V2/conv_add_bn_kernel.cpp +++ b/src/operators/kernel/fpga/V2/conv_add_bn_kernel.cpp @@ -58,7 +58,7 @@ bool ConvAddBNKernel::Init(FusionConvAddBNParam *param) { param->SetNewScale(new_scale); param->SetNewBias(new_bias); - fpga::format_conv_data(filter, out, bs_ptr, param->Groups()); + fpga::format_conv_data(filter, out, &bs_ptr, param->Groups()); fpga::SplitConvArgs conv_arg = {0}; fpga::fill_split_arg(&conv_arg, input, out, filter, relu_enabled, diff --git a/src/operators/kernel/fpga/V2/conv_add_bn_relu_kernel.cpp b/src/operators/kernel/fpga/V2/conv_add_bn_relu_kernel.cpp index 8737554e6f8c343491656ca7659e1850d84ea246..266ebe012e0db3ef3b2ac21f81f4436d143ece59 100644 --- a/src/operators/kernel/fpga/V2/conv_add_bn_relu_kernel.cpp +++ b/src/operators/kernel/fpga/V2/conv_add_bn_relu_kernel.cpp @@ -56,7 +56,7 @@ bool ConvAddBNReluKernel::Init( param->SetNewScale(new_scale); param->SetNewBias(new_bias); - fpga::format_conv_data(filter, out, bs_ptr, param->Groups()); + fpga::format_conv_data(filter, out, &bs_ptr, param->Groups()); fpga::SplitConvArgs conv_arg = {0}; fpga::fill_split_arg(&conv_arg, input, out, filter, relu_enabled, diff --git a/src/operators/kernel/fpga/V2/conv_add_kernel.cpp b/src/operators/kernel/fpga/V2/conv_add_kernel.cpp index 22841e705c255433bebeab479a2e2b8d3a3b7187..e9c5032779b4e6b63f82355cd2a5634c1fae88de 100644 --- a/src/operators/kernel/fpga/V2/conv_add_kernel.cpp +++ b/src/operators/kernel/fpga/V2/conv_add_kernel.cpp @@ -38,7 +38,7 @@ bool ConvAddKernel::Init(FusionConvAddParam *param) { bs_ptr[i] = bias_ptr[i]; } - fpga::format_conv_data(filter, out, bs_ptr, param->Groups()); + fpga::format_conv_data(filter, out, &bs_ptr, param->Groups()); fpga::SplitConvArgs conv_arg = {0}; fpga::fill_split_arg(&conv_arg, input, out, filter, relu_enabled, diff --git a/src/operators/kernel/fpga/V2/conv_add_relu_kernel.cpp b/src/operators/kernel/fpga/V2/conv_add_relu_kernel.cpp index a3c4443645e421ee0dce10f53914600fb7af75bf..1002a358434046b05fee41b60281cc594a093808 100644 --- a/src/operators/kernel/fpga/V2/conv_add_relu_kernel.cpp +++ b/src/operators/kernel/fpga/V2/conv_add_relu_kernel.cpp @@ -38,7 +38,7 @@ bool ConvAddReluKernel::Init(FusionConvAddReluParam *param) { bs_ptr[i] = bias_ptr[i]; } - fpga::format_conv_data(filter, out, bs_ptr, param->Groups()); + fpga::format_conv_data(filter, out, &bs_ptr, param->Groups()); fpga::SplitConvArgs conv_arg = {0}; fpga::fill_split_arg(&conv_arg, input, out, filter, relu_enabled, diff --git a/src/operators/kernel/fpga/V2/conv_bn_kernel.cpp b/src/operators/kernel/fpga/V2/conv_bn_kernel.cpp index 070fce98b9e5f0c7055943447602dba8ae78c7c4..cb32c0fe040b9c55de660269fbfc3598ea9722bf 100644 --- a/src/operators/kernel/fpga/V2/conv_bn_kernel.cpp +++ b/src/operators/kernel/fpga/V2/conv_bn_kernel.cpp @@ -50,7 +50,7 @@ bool ConvBNKernel::Init(FusionConvBNParam *param) { param->SetNewScale(new_scale); param->SetNewBias(new_bias); - fpga::format_conv_data(filter, out, bs_ptr, param->Groups()); + fpga::format_conv_data(filter, out, &bs_ptr, param->Groups()); fpga::SplitConvArgs conv_arg = {0}; fpga::fill_split_arg(&conv_arg, input, out, filter, relu_enabled, diff --git a/src/operators/kernel/fpga/V2/conv_bn_relu_kernel.cpp b/src/operators/kernel/fpga/V2/conv_bn_relu_kernel.cpp index 95ac74cbf87fe20ef419e748f8a8a04df20c98e3..918b65bd347811f9a2cc6b1182c54d9f39a9082e 100644 --- a/src/operators/kernel/fpga/V2/conv_bn_relu_kernel.cpp +++ b/src/operators/kernel/fpga/V2/conv_bn_relu_kernel.cpp @@ -15,6 +15,7 @@ limitations under the License. */ #ifdef FUSION_CONVBNRELU_OP #include "operators/kernel/conv_bn_relu_kernel.h" +#include "fpga/V2/filter.h" namespace paddle_mobile { namespace operators { @@ -50,7 +51,7 @@ bool ConvBNReluKernel::Init(FusionConvBNReluParam *param) { param->SetNewScale(new_scale); param->SetNewBias(new_bias); - fpga::format_conv_data(filter, out, bs_ptr, param->Groups()); + fpga::format_conv_data(filter, out, &bs_ptr, param->Groups()); fpga::SplitConvArgs conv_arg = {0}; fpga::fill_split_arg(&conv_arg, input, out, filter, relu_enabled,