23.11
|
Go to the documentation of this file.
47 constexpr
int window_step_x = 8;
48 const auto window_start_x =
static_cast<int>(window.
x().
start());
49 const auto window_end_x =
static_cast<int>(window.
x().
end());
60 const auto vconst_1 = vdupq_n_f32(1.f);
61 const float32x4_t va_f32 = vdupq_n_f32(
act_info.a());
62 const float32x4_t vb_f32 = vdupq_n_f32(
act_info.b());
70 const auto input_ptr =
reinterpret_cast<const qsymm16_t *
>(
input.ptr());
71 const auto output_ptr =
reinterpret_cast<qsymm16_t *
>(output.
ptr());
77 int x = window_start_x;
78 for (; x <= (window_end_x - window_step_x); x += window_step_x)
81 if (act == ActivationLayerInfo::ActivationFunction::LOGISTIC)
86 const float32x4x2_t tmp_dep = {{
93 else if (act == ActivationLayerInfo::ActivationFunction::TANH)
98 const float32x4x2_t tmp_dep = {{
106 else if (act == ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU)
124 for (; x < window_end_x; ++x)
128 if (act == ActivationLayerInfo::ActivationFunction::LOGISTIC)
131 tmp_f = 1.f / (1.f + std::exp(-tmp_f));
134 else if (act == ActivationLayerInfo::ActivationFunction::TANH)
137 tmp_f = a_f32 * std::tanh(b_f32 * tmp_f);
140 else if (act == ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU)
143 tmp_f = std::min<float>(a_f32, std::max<float>(b_f32, tmp_f));
150 *(output_ptr + x) = tmp;
uint8x8_t vadd(const uint8x8_t &a, const uint8x8_t &b)
constexpr int start() const
Return the start of the dimension.
SimpleTensor< float > src
int16_t quantize_qsymm16(float value, const UniformQuantizationInfo &qinfo, RoundingPolicy rounding_policy=RoundingPolicy::TO_NEAREST_UP)
Quantize a value given a 16-bit symmetric quantization scheme.
float32x4x2_t vdequantize_int16(const int16x8_t &qv, float scale)
Dequantize a neon vector holding 8 16-bit quantized values.
float32x4_t vexpq(const float32x4_t &a)
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.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
float32x4_t vtanh(const float32x4_t &a)
Interface for CPU tensor.
void neon_qsymm16_activation(const ITensor *src, ITensor *dst, const ActivationLayerInfo &act_info, const Window &window)
uint8x16_t vloadq(const uint8_t *ptr)
Includes all wrapper headers at once.
int16x8_t vquantize_int16(const float32x4x2_t &qv, float scale)
Quantize a neon vector holding 8 floating point values.
uint8x8_t vmin(const uint8x8_t &a, const uint8x8_t &b)
Activation Layer Information class.
constexpr uint8_t * ptr() const
Return a pointer to the current pixel.
uint8x8_t vmul(const uint8x8_t &a, const uint8x8_t &b)
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...
Iterator updated by execute_window_loop for each window element.
typename neon_bitvector< T, BW >::type neon_bitvector_t
Helper type template to get the type of a neon vector.
ActivationFunction
Available activation functions.
float dequantize_qsymm16(int16_t value, const UniformQuantizationInfo &qinfo)
Dequantize a value given a 16-bit symmetric quantization scheme.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
int8x8_t vneg(const int8x8_t &a)
Describe one of the image's dimensions with a start, end and step.
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
uint8x8_t vmax(const uint8x8_t &a, const uint8x8_t &b)
void vstore(uint8_t *ptr, uint8x8_t val)
Describe a multidimensional execution window.
int16_t qsymm16_t
16 bit quantized symmetric scalar value
Copyright (c) 2017-2023 Arm Limited.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
float32x2_t vdiv(const float32x2_t &a, const float32x2_t &b)
constexpr int end() const
Return the end of the dimension.
constexpr const Dimension & x() const
Alias to access the first dimension of the window.