46 const auto window_start_x =
static_cast<int>(window.
x().
start());
47 const auto window_end_x =
static_cast<int>(window.
x().
end());
58 const auto vconst_1 = svdup_n_f32(1.f);
59 const auto va_f32 = svdup_n_f32(
act_info.a());
60 const auto vb_f32 = svdup_n_f32(
act_info.b());
66 const auto input_ptr =
reinterpret_cast<const int16_t *
>(
input.ptr());
67 const auto output_ptr =
reinterpret_cast<int16_t *
>(output.
ptr());
71 int x = window_start_x;
72 svbool_t pg = svwhilelt_b16(x, window_end_x);
75 const auto vin = svld1_s16(pg, input_ptr + x);
76 if (act == ActivationLayerInfo::ActivationFunction::LOGISTIC)
79 auto vin_deq = svdequantize_qsymm16_z(pg, vin, qi_in.
scale);
81 const svfloat32x2_t tmp_dep = svcreate2_f32(
84 svadd_f32_z(pg, vconst_1, svexp_f32_z(pg, svneg_f32_z(pg, svget2_f32(vin_deq, 0))))),
87 svadd_f32_z(pg, vconst_1, svexp_f32_z(pg, svneg_f32_z(pg, svget2_f32(vin_deq, 1))))));
89 tmp = svquantize_qsymm16_z(pg, tmp_dep, qi_out.
scale);
91 else if (act == ActivationLayerInfo::ActivationFunction::TANH)
94 auto vin_deq = svdequantize_qsymm16_z(pg, vin, qi_in.
scale);
96 const svfloat32x2_t tmp_dep = svcreate2_f32(
97 svmul_f32_z(pg, va_f32, svtanh_f32_z(pg, svmul_f32_z(pg, svget2_f32(vin_deq, 0), vb_f32))),
98 svmul_f32_z(pg, va_f32, svtanh_f32_z(pg, svmul_f32_z(pg, svget2_f32(vin_deq, 1), vb_f32))));
100 tmp = svquantize_qsymm16_z(pg, tmp_dep, qi_out.
scale);
102 else if (act == ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU)
105 auto vin_deq = svdequantize_qsymm16_z(pg, vin, qi_in.
scale);
107 const svfloat32x2_t tmp_dep =
108 svcreate2_f32(svmin_f32_z(pg, va_f32, svmax_f32_z(pg, vb_f32, svget2_f32(vin_deq, 0))),
109 svmin_f32_z(pg, va_f32, svmax_f32_z(pg, vb_f32, svget2_f32(vin_deq, 1))));
111 tmp = svquantize_qsymm16_z(pg, tmp_dep, qi_out.
scale);
118 svst1_s16(pg, output_ptr + x, tmp);
121 pg = svwhilelt_b16(x, window_end_x);
123 }
while (svptest_any(svptrue_b16(), pg));