File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
backends/cadence/vision/kernels Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 1111#include < algorithm>
1212#include < cstring>
1313#include < limits>
14- #include < numeric>
1514
1615namespace impl {
1716namespace vision {
@@ -25,10 +24,10 @@ void* allocate_temp_memory(KernelRuntimeContext& ctx, size_t size) {
2524// Quantize a fp32 value to an int8_t/uint8_t value
2625template <typename T>
2726T quantize (const float x, float scale, int32_t zero_point) {
28- constexpr float min_val = std::numeric_limits<T>::min ();
29- constexpr float max_val = std::numeric_limits<T>::max ();
27+ constexpr float kMinValue = static_cast < float >( std::numeric_limits<T>::min () );
28+ constexpr float kMaxValue = static_cast < float >( std::numeric_limits<T>::max () );
3029 float tmp = roundf (x * scale + zero_point);
31- return std::max (std::min (tmp, max_val ), min_val );
30+ return std::max (std::min (tmp, kMaxValue ), kMinValue );
3231}
3332
3433// Quantize an fp32 array to an int8_t/uint8_t array
You can’t perform that action at this time.
0 commit comments