| 81 | |
| 82 | template <typename T1, typename T2> |
| 83 | SimpleTensor<T2> accumulate_squared(const SimpleTensor<T1> &src, uint32_t shift, DataType output_data_type) |
| 84 | { |
| 85 | ARM_COMPUTE_ERROR_ON_MSG(shift > 15, "Shift in accumulate_squared must be within the range [0, 15]"); |
| 86 | |
| 87 | SimpleTensor<T2> dst{src.shape(), output_data_type}; |
| 88 | |
| 89 | library->fill_tensor_uniform(dst, 1, static_cast<T2>(0), static_cast<T2>(std::numeric_limits<T1>::max())); |
| 90 | |
| 91 | using intermediate_type = typename common_promoted_signed_type<T1, T2>::intermediate_type; |
| 92 | intermediate_type denom = 1 << shift; |
| 93 | #if defined(_OPENMP) |
| 94 | #pragma omp parallel for |
| 95 | #endif /* _OPENMP */ |
| 96 | for (int i = 0; i < src.num_elements(); ++i) |
| 97 | { |
| 98 | intermediate_type val = |
| 99 | static_cast<intermediate_type>(dst[i]) + |
| 100 | (static_cast<intermediate_type>(src[i]) * static_cast<intermediate_type>(src[i]) / denom); |
| 101 | dst[i] = saturate_cast<T2>(val); |
| 102 | } |
| 103 | |
| 104 | return dst; |
| 105 | } |
| 106 | |
| 107 | template SimpleTensor<int16_t> accumulate(const SimpleTensor<uint8_t> &src, DataType output_data_type); |
| 108 | template SimpleTensor<uint8_t> |
nothing calls this directly
no test coverage detected