aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/Utils.h
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2021-03-30 10:03:01 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2021-03-31 11:44:07 +0000
commitc6f9510bcb754afaadfe9477ff85d6c55ffcf43b (patch)
treec1b08777a93ab9d2e334c71acf30f337bdb3feda /arm_compute/core/Utils.h
parent2788609b8a10306e9eae47543b39812a7b075aaa (diff)
downloadComputeLibrary-c6f9510bcb754afaadfe9477ff85d6c55ffcf43b.tar.gz
Remove Computer Vision generic interfaces and types
Removes: - reference validation routines - CV related types and structures - CV related interfaces Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: I3a203da12d9b04c154059b190aeba18a611149a9 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5340 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/Utils.h')
-rw-r--r--arm_compute/core/Utils.h201
1 files changed, 0 insertions, 201 deletions
diff --git a/arm_compute/core/Utils.h b/arm_compute/core/Utils.h
index 19ed73781e..d5c365e6ab 100644
--- a/arm_compute/core/Utils.h
+++ b/arm_compute/core/Utils.h
@@ -655,82 +655,6 @@ inline bool has_format_vertical_subsampling(Format format)
return (format == Format::NV12 || format == Format::NV21 || format == Format::IYUV || format == Format::UV88) ? true : false;
}
-/** Separate a 2D convolution into two 1D convolutions
- *
- * @param[in] conv 2D convolution
- * @param[out] conv_col 1D vertical convolution
- * @param[out] conv_row 1D horizontal convolution
- * @param[in] size Size of the 2D convolution
- *
- * @return true if the separation was successful
- */
-inline bool separate_matrix(const int16_t *conv, int16_t *conv_col, int16_t *conv_row, uint8_t size)
-{
- int32_t min_col = -1;
- int16_t min_col_val = -1;
-
- for(int32_t i = 0; i < size; ++i)
- {
- if(conv[i] != 0 && (min_col < 0 || abs(min_col_val) > abs(conv[i])))
- {
- min_col = i;
- min_col_val = conv[i];
- }
- }
-
- if(min_col < 0)
- {
- return false;
- }
-
- for(uint32_t j = 0; j < size; ++j)
- {
- conv_col[j] = conv[min_col + j * size];
- }
-
- for(uint32_t i = 0; i < size; i++)
- {
- if(static_cast<int>(i) == min_col)
- {
- conv_row[i] = 1;
- }
- else
- {
- int16_t coeff = conv[i] / conv[min_col];
-
- for(uint32_t j = 1; j < size; ++j)
- {
- if(conv[i + j * size] != (conv_col[j] * coeff))
- {
- return false;
- }
- }
-
- conv_row[i] = coeff;
- }
- }
-
- return true;
-}
-
-/** Calculate the scale of the given square matrix
- *
- * The scale is the absolute value of the sum of all the coefficients in the matrix.
- *
- * @note If the coefficients add up to 0 then the scale is set to 1.
- *
- * @param[in] matrix Matrix coefficients
- * @param[in] matrix_size Number of elements per side of the square matrix. (Number of coefficients = matrix_size * matrix_size).
- *
- * @return The absolute value of the sum of the coefficients if they don't add up to 0, otherwise 1.
- */
-inline uint32_t calculate_matrix_scale(const int16_t *matrix, unsigned int matrix_size)
-{
- const size_t size = matrix_size * matrix_size;
-
- return std::max(1, std::abs(std::accumulate(matrix, matrix + size, 0)));
-}
-
/** Adjust tensor shape size if width or height are odd for a given multi-planar format. No modification is done for other formats.
*
* @note Adding here a few links discussing the issue of odd size and sharing the same solution:
@@ -794,117 +718,6 @@ inline TensorShape calculate_subsampled_shape(const TensorShape &shape, Format f
return output;
}
-/** Calculate accurary required by the horizontal and vertical convolution computations
- *
- * @param[in] conv_col Pointer to the vertical vector of the separated convolution filter
- * @param[in] conv_row Pointer to the horizontal vector of the convolution filter
- * @param[in] size Number of elements per vector of the separated matrix
- *
- * @return The return type is a pair. The first element of the pair is the biggest data type needed for the first stage. The second
- * element of the pair is the biggest data type needed for the second stage.
- */
-inline std::pair<DataType, DataType> data_type_for_convolution(const int16_t *conv_col, const int16_t *conv_row, size_t size)
-{
- DataType first_stage = DataType::UNKNOWN;
- DataType second_stage = DataType::UNKNOWN;
-
- auto gez = [](const int16_t &v)
- {
- return v >= 0;
- };
-
- auto accu_neg = [](const int &first, const int &second)
- {
- return first + (second < 0 ? second : 0);
- };
-
- auto accu_pos = [](const int &first, const int &second)
- {
- return first + (second > 0 ? second : 0);
- };
-
- const bool only_positive_coefficients = std::all_of(conv_row, conv_row + size, gez) && std::all_of(conv_col, conv_col + size, gez);
-
- if(only_positive_coefficients)
- {
- const int max_row_value = std::accumulate(conv_row, conv_row + size, 0) * UINT8_MAX;
- const int max_value = std::accumulate(conv_col, conv_col + size, 0) * max_row_value;
-
- first_stage = (max_row_value <= UINT16_MAX) ? DataType::U16 : DataType::S32;
-
- second_stage = (max_value <= UINT16_MAX) ? DataType::U16 : DataType::S32;
- }
- else
- {
- const int min_row_value = std::accumulate(conv_row, conv_row + size, 0, accu_neg) * UINT8_MAX;
- const int max_row_value = std::accumulate(conv_row, conv_row + size, 0, accu_pos) * UINT8_MAX;
- const int neg_coeffs_sum = std::accumulate(conv_col, conv_col + size, 0, accu_neg);
- const int pos_coeffs_sum = std::accumulate(conv_col, conv_col + size, 0, accu_pos);
- const int min_value = neg_coeffs_sum * max_row_value + pos_coeffs_sum * min_row_value;
- const int max_value = neg_coeffs_sum * min_row_value + pos_coeffs_sum * max_row_value;
-
- first_stage = ((INT16_MIN <= min_row_value) && (max_row_value <= INT16_MAX)) ? DataType::S16 : DataType::S32;
-
- second_stage = ((INT16_MIN <= min_value) && (max_value <= INT16_MAX)) ? DataType::S16 : DataType::S32;
- }
-
- return std::make_pair(first_stage, second_stage);
-}
-
-/** Calculate the accuracy required by the squared convolution calculation.
- *
- *
- * @param[in] conv Pointer to the squared convolution matrix
- * @param[in] size The total size of the convolution matrix
- *
- * @return The return is the biggest data type needed to do the convolution
- */
-inline DataType data_type_for_convolution_matrix(const int16_t *conv, size_t size)
-{
- auto gez = [](const int16_t v)
- {
- return v >= 0;
- };
-
- const bool only_positive_coefficients = std::all_of(conv, conv + size, gez);
-
- if(only_positive_coefficients)
- {
- const int max_conv_value = std::accumulate(conv, conv + size, 0) * UINT8_MAX;
- if(max_conv_value <= UINT16_MAX)
- {
- return DataType::U16;
- }
- else
- {
- return DataType::S32;
- }
- }
- else
- {
- const int min_value = std::accumulate(conv, conv + size, 0, [](int a, int b)
- {
- return b < 0 ? a + b : a;
- })
- * UINT8_MAX;
-
- const int max_value = std::accumulate(conv, conv + size, 0, [](int a, int b)
- {
- return b > 0 ? a + b : a;
- })
- * UINT8_MAX;
-
- if((INT16_MIN <= min_value) && (INT16_MAX >= max_value))
- {
- return DataType::S16;
- }
- else
- {
- return DataType::S32;
- }
- }
-}
-
/** Permutes the given dimensions according the permutation vector
*
* @param[in,out] dimensions Dimensions to be permuted.
@@ -1024,13 +837,6 @@ const std::string &string_from_data_layout(DataLayout dl);
* @return The string describing the data type.
*/
const std::string &string_from_data_type(DataType dt);
-/** Convert a matrix pattern into a string.
- *
- * @param[in] pattern @ref MatrixPattern to be translated to string.
- *
- * @return The string describing the matrix pattern.
- */
-const std::string &string_from_matrix_pattern(MatrixPattern pattern);
/** Translates a given activation function to a string.
*
* @param[in] act @ref ActivationLayerInfo::ActivationFunction to be translated to string.
@@ -1038,13 +844,6 @@ const std::string &string_from_matrix_pattern(MatrixPattern pattern);
* @return The string describing the activation function.
*/
const std::string &string_from_activation_func(ActivationLayerInfo::ActivationFunction act);
-/** Translates a given non linear function to a string.
- *
- * @param[in] function @ref NonLinearFilterFunction to be translated to string.
- *
- * @return The string describing the non linear function.
- */
-const std::string &string_from_non_linear_filter_function(NonLinearFilterFunction function);
/** Translates a given interpolation policy to a string.
*
* @param[in] policy @ref InterpolationPolicy to be translated to string.