提交 678ee306 编写于 作者: qnqinan's avatar qnqinan

fix a bug in ewadd in FPGA v2, test=mobile

上级 c6c1d514
......@@ -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<uint32_t*>(&quantParam);
uint64_t ew_scale_mult_factor = (*ew_scale) |
((uint64_t)args.const0 << 32) | ((uint64_t)args.const1 << 40);
......
......@@ -33,8 +33,8 @@ bool ElementwiseAddKernel<FPGA, float>::Init(ElementwiseAddParam<FPGA> *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];
......
......@@ -35,8 +35,8 @@ bool ElementwiseAddReluKernel<FPGA, float>::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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册