diff --git a/mobile/src/fpga/V2/pe.cpp b/mobile/src/fpga/V2/pe.cpp index a3c179994a2be8dc4a87441febc7e6db4ecd797c..1443888c3f79950af485be0a9a6d854fa6aa4e4a 100755 --- a/mobile/src/fpga/V2/pe.cpp +++ b/mobile/src/fpga/V2/pe.cpp @@ -534,7 +534,8 @@ uint64_t bypass_interrupt = reg_readq(REG_INTERRUPT); (((uint64_t)args.image0.height * 2) << 32); uint64_t image_row_col_padding_down = image_amount_per_row | (image_amount_per_row << 32); - float quantParam = (args.output.scale_address)[0]; + float quantParam = + ((args.image0.scale_address)[0]) / ((args.output.scale_address)[0]); uint32_t* ew_scale = reinterpret_cast(&quantParam); uint64_t ew_scale_mult_factor = (*ew_scale) | ((uint64_t)args.const0 << 32) | ((uint64_t)args.const1 << 40); diff --git a/mobile/src/operators/kernel/fpga/V2/elementwise_add_kernel.cpp b/mobile/src/operators/kernel/fpga/V2/elementwise_add_kernel.cpp index 57ccf9f00d9e4ab04bbed16af8b02e4aaa537847..ab87d712929ca1035cb497f483814220b5c1d100 100755 --- a/mobile/src/operators/kernel/fpga/V2/elementwise_add_kernel.cpp +++ b/mobile/src/operators/kernel/fpga/V2/elementwise_add_kernel.cpp @@ -33,8 +33,8 @@ bool ElementwiseAddKernel::Init(ElementwiseAddParam *param) { float C1 = Si_1 / So; float C2 = Si_2 / So; fpga::EWAddArgs ewaddArgs = {0}; - ewaddArgs.const0 = fpga::fp32_2_fp16(C1); - ewaddArgs.const1 = fpga::fp32_2_fp16(C2); + ewaddArgs.const0 = 1; + ewaddArgs.const1 = 1; ewaddArgs.relu_enabled = 0; ewaddArgs.image0.address = input_x_ptr; ewaddArgs.image0.channels = (uint32_t)input_x->dims()[1]; diff --git a/mobile/src/operators/kernel/fpga/V2/elementwise_add_relu_kernel.cpp b/mobile/src/operators/kernel/fpga/V2/elementwise_add_relu_kernel.cpp index de603418742da5b9672259a1bb414567853a8cb5..a55a78e566068213b843eb4cd9eb1624237eec3d 100755 --- a/mobile/src/operators/kernel/fpga/V2/elementwise_add_relu_kernel.cpp +++ b/mobile/src/operators/kernel/fpga/V2/elementwise_add_relu_kernel.cpp @@ -35,8 +35,8 @@ bool ElementwiseAddReluKernel::Init( float C2 = Si_2 / So; fpga::EWAddArgs ewaddArgs = {0}; ewaddArgs.relu_enabled = 1; - ewaddArgs.const0 = fpga::fp32_2_fp16(C1); - ewaddArgs.const1 = fpga::fp32_2_fp16(C2); + ewaddArgs.const0 = 1; + ewaddArgs.const1 = 1; ewaddArgs.image0.address = input_x_ptr; ewaddArgs.image0.channels = (uint32_t)input_x->dims()[1]; ewaddArgs.image0.scale_address = input_x->scale;