42 const auto window_start_x =
static_cast<int>(window.
x().
start());
43 const auto window_end_x =
static_cast<int>(window.
x().
end());
54 const auto vconst_1 = svdup_n_f32(1.f);
55 const auto va_f32 = svdup_n_f32(act_info.
a());
56 const auto vb_f32 = svdup_n_f32(act_info.
b());
60 const auto input_ptr =
reinterpret_cast<const int16_t *
>(input.
ptr());
61 const auto output_ptr =
reinterpret_cast<int16_t *
>(output.
ptr());
65 int x = window_start_x;
66 svbool_t pg = svwhilelt_b16(x, window_end_x);
69 const auto vin = svld1_s16(pg, input_ptr + x);
73 auto vin_deq = svdequantize_qsymm16_z(pg, vin, qi_in.
scale);
75 const svfloat32x2_t tmp_dep = svcreate2_f32(svdiv_f32_z(pg, vconst_1, svadd_f32_z(pg, vconst_1, svexp_f32_z(pg, svneg_f32_z(pg, svget2_f32(vin_deq, 0))))),
76 svdiv_f32_z(pg, vconst_1, svadd_f32_z(pg, vconst_1, svexp_f32_z(pg, svneg_f32_z(pg, svget2_f32(vin_deq, 1))))));
78 tmp = svquantize_qsymm16_z(pg, tmp_dep, qi_out.
scale);
83 auto vin_deq = svdequantize_qsymm16_z(pg, vin, qi_in.
scale);
85 const svfloat32x2_t tmp_dep = svcreate2_f32(svmul_f32_z(pg, va_f32, svtanh_f32_z(pg, svmul_f32_z(pg, svget2_f32(vin_deq, 0), vb_f32))),
86 svmul_f32_z(pg, va_f32, svtanh_f32_z(pg, svmul_f32_z(pg, svget2_f32(vin_deq, 1), vb_f32))));
88 tmp = svquantize_qsymm16_z(pg, tmp_dep, qi_out.
scale);
93 auto vin_deq = svdequantize_qsymm16_z(pg, vin, qi_in.
scale);
95 const svfloat32x2_t tmp_dep = svcreate2_f32(svmin_f32_z(pg, va_f32, svmax_f32_z(pg, vb_f32, svget2_f32(vin_deq, 0))),
96 svmin_f32_z(pg, va_f32, svmax_f32_z(pg, vb_f32, svget2_f32(vin_deq, 1))));
98 tmp = svquantize_qsymm16_z(pg, tmp_dep, qi_out.
scale);
105 svst1_s16(pg, output_ptr + x, tmp);
108 pg = svwhilelt_b16(x, window_end_x);
111 while(svptest_any(svptrue_b16(), pg));
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
float a() const
Get the alpha value.
Describe one of the image's dimensions with a start, end and step.
void sve2_qsymm16_activation(const ITensor *src, ITensor *dst, const ActivationLayerInfo &act_info, const Window &window)
Activation Layer Information class.
Interface for CPU tensor.
SimpleTensor< float > src
Copyright (c) 2017-2022 Arm Limited.
ActivationFunction
Available activation functions.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
Window collapse_if_possible(const Window &full_window, size_t first, size_t last, bool *has_collapsed=nullptr) const
Collapse the dimensions between first and last if possible.
UniformQuantizationInfo uniform() const
Return per layer quantization info.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
constexpr uint8_t * ptr() const
Return a pointer to the current pixel.
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
virtual QuantizationInfo quantization_info() const =0
Get the quantization settings (scale and offset) of the tensor.
Lower and Upper Bounded Rectifier ( )
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
ActivationFunction activation() const
Get the type of activation function.
float b() const
Get the beta value.
constexpr int end() const
Return the end of the dimension.
Iterator updated by execute_window_loop for each window element.
constexpr int start() const
Return the start of the dimension.
Describe a multidimensional execution window.
constexpr const Dimension & x() const
Alias to access the first dimension of the window.