MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / remove_dimension

Method remove_dimension

arm_compute/core/TensorShape.h:113–131  ·  view source on GitHub ↗

Accessor to remove the dimension n from the tensor shape. * * @note The upper dimensions of the tensor shape will be shifted down by 1 * * @param[in] n Dimension to remove * @param[in] apply_dim_correction (Optional) Flag to state whether apply dimension correction (removing trailing dimensions with size of 1) after removing a dimension. */

Source from the content-addressed store, hash-verified

111 * @param[in] apply_dim_correction (Optional) Flag to state whether apply dimension correction (removing trailing dimensions with size of 1) after removing a dimension.
112 */
113 void remove_dimension(size_t n, bool apply_dim_correction = true)
114 {
115 ARM_COMPUTE_ERROR_ON(_num_dimensions < 1);
116 ARM_COMPUTE_ERROR_ON(n >= _num_dimensions);
117
118 std::copy(_id.begin() + n + 1, _id.end(), _id.begin() + n);
119
120 // Reduce number of dimensions
121 _num_dimensions--;
122
123 // Make sure all empty dimensions are filled with 1
124 std::fill(_id.begin() + _num_dimensions, _id.end(), 1);
125
126 // Correct number dimensions to ignore trailing dimensions of size 1
127 if (apply_dim_correction)
128 {
129 apply_dimension_correction();
130 }
131 }
132
133 /** Collapse the first n dimensions.
134 *

Callers 15

compute_reductionA_shapeFunction · 0.80
compute_reductionB_shapeFunction · 0.80
compute_min_max_shapeFunction · 0.80
compute_reduced_shapeFunction · 0.80
calculate_unstack_shapeFunction · 0.80
configureMethod · 0.80
validate_configFunction · 0.80

Calls 4

fillFunction · 0.85
copyFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected