Compute Library
 23.11
Utils.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2023 Arm Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifndef ARM_COMPUTE_UTILS_H
25 #define ARM_COMPUTE_UTILS_H
26 
27 #include "arm_compute/core/Error.h"
29 #include "arm_compute/core/Types.h"
30 
31 #include <cmath>
32 #include <numeric>
33 #include <sstream>
34 #include <string>
35 #include <type_traits>
36 #include <unordered_map>
37 #include <utility>
38 
39 /* Convenience / backwards compatibility includes */
46 
47 namespace arm_compute
48 {
49 class ITensor;
50 class ITensorInfo;
51 class ActivationLayerInfo;
52 
53 /** Load an entire file in memory
54  *
55  * @param[in] filename Name of the file to read.
56  * @param[in] binary Is it a binary file ?
57  *
58  * @return The content of the file.
59  */
60 std::string read_file(const std::string &filename, bool binary);
61 
62 /** Permutes the given dimensions according the permutation vector
63  *
64  * @param[in,out] dimensions Dimensions to be permuted.
65  * @param[in] perm Vector describing the permutation.
66  *
67  */
68 template <typename T>
69 inline void permute_strides(Dimensions<T> &dimensions, const PermutationVector &perm)
70 {
71  const auto old_dim = utility::make_array<Dimensions<T>::num_max_dimensions>(dimensions.begin(), dimensions.end());
72  for (unsigned int i = 0; i < perm.num_dimensions(); ++i)
73  {
74  T dimension_val = old_dim[i];
75  dimensions.set(perm[i], dimension_val);
76  }
77 }
78 
79 /** Calculate padding requirements in case of SAME padding
80  *
81  * @param[in] input_shape Input shape
82  * @param[in] weights_shape Weights shape
83  * @param[in] conv_info Convolution information (containing strides)
84  * @param[in] data_layout (Optional) Data layout of the input and weights tensor
85  * @param[in] dilation (Optional) Dilation factor used in the convolution.
86  * @param[in] rounding_type (Optional) Dimension rounding type when down-scaling.
87  *
88  * @return PadStrideInfo for SAME padding
89  */
90 PadStrideInfo calculate_same_pad(TensorShape input_shape,
91  TensorShape weights_shape,
92  PadStrideInfo conv_info,
94  const Size2D &dilation = Size2D(1u, 1u),
96 
97 /** Returns expected width and height of the deconvolution's output tensor.
98  *
99  * @param[in] in_width Width of input tensor (Number of columns)
100  * @param[in] in_height Height of input tensor (Number of rows)
101  * @param[in] kernel_width Kernel width.
102  * @param[in] kernel_height Kernel height.
103  * @param[in] pad_stride_info Pad and stride information.
104  *
105  * @return A pair with the new width in the first position and the new height in the second.
106  */
107 std::pair<unsigned int, unsigned int> deconvolution_output_dimensions(unsigned int in_width,
108  unsigned int in_height,
109  unsigned int kernel_width,
110  unsigned int kernel_height,
111  const PadStrideInfo &pad_stride_info);
112 
113 /** Returns expected width and height of output scaled tensor depending on dimensions rounding mode.
114  *
115  * @param[in] width Width of input tensor (Number of columns)
116  * @param[in] height Height of input tensor (Number of rows)
117  * @param[in] kernel_width Kernel width.
118  * @param[in] kernel_height Kernel height.
119  * @param[in] pad_stride_info Pad and stride information.
120  * @param[in] dilation (Optional) Dilation, in elements, across x and y. Defaults to (1, 1).
121  *
122  * @return A pair with the new width in the first position and the new height in the second.
123  */
124 std::pair<unsigned int, unsigned int> scaled_dimensions(int width,
125  int height,
126  int kernel_width,
127  int kernel_height,
128  const PadStrideInfo &pad_stride_info,
129  const Size2D &dilation = Size2D(1U, 1U));
130 
131 /** Returns calculated width and height of output scaled tensor depending on dimensions rounding mode.
132  *
133  * @param[in] width Width of input tensor (Number of columns)
134  * @param[in] height Height of input tensor (Number of rows)
135  * @param[in] kernel_width Kernel width.
136  * @param[in] kernel_height Kernel height.
137  * @param[in] pad_stride_info Pad and stride information.
138  *
139  * @return A pair with the new width in the first position and the new height in the second, returned values can be < 1
140  */
141 std::pair<int, int> scaled_dimensions_signed(
142  int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info);
143 
144 /** Returns calculated width, height and depth of output scaled tensor depending on dimensions rounding mode.
145  *
146  * @param[in] width Width of input tensor
147  * @param[in] height Height of input tensor
148  * @param[in] depth Depth of input tensor
149  * @param[in] kernel_width Kernel width.
150  * @param[in] kernel_height Kernel height.
151  * @param[in] kernel_depth Kernel depth.
152  * @param[in] pool3d_info Pad and stride and round information for 3d pooling
153  *
154  * @return A tuple with the new width in the first position, the new height in the second, and the new depth in the third.
155  * Returned values can be < 1
156  */
157 std::tuple<int, int, int> scaled_3d_dimensions_signed(int width,
158  int height,
159  int depth,
160  int kernel_width,
161  int kernel_height,
162  int kernel_depth,
163  const Pooling3dLayerInfo &pool3d_info);
164 
165 /** Check if the given reduction operation should be handled in a serial way.
166  *
167  * @param[in] op Reduction operation to perform
168  * @param[in] dt Data type
169  * @param[in] axis Axis along which to reduce
170  *
171  * @return True if the given reduction operation should be handled in a serial way.
172  */
173 bool needs_serialized_reduction(ReductionOperation op, DataType dt, unsigned int axis);
174 
175 /** Returns output quantization information for softmax layer
176  *
177  * @param[in] input_type The data type of the input tensor
178  * @param[in] is_log True for log softmax
179  *
180  * @return Quantization information for the output tensor
181  */
182 QuantizationInfo get_softmax_output_quantization_info(DataType input_type, bool is_log);
183 
184 /** Returns a pair of minimum and maximum values for a quantized activation
185  *
186  * @param[in] act_info The information for activation
187  * @param[in] data_type The used data type
188  * @param[in] oq_info The output quantization information
189  *
190  * @return The pair with minimum and maximum values
191  */
192 std::pair<int32_t, int32_t> get_quantized_activation_min_max(const ActivationLayerInfo &act_info,
194  UniformQuantizationInfo oq_info);
195 
196 /** Convert a channel identity into a string.
197  *
198  * @param[in] channel @ref Channel to be translated to string.
199  *
200  * @return The string describing the channel.
201  */
202 const std::string &string_from_channel(Channel channel);
203 
204 /** Translates a given border mode policy to a string.
205  *
206  * @param[in] border_mode @ref BorderMode to be translated to string.
207  *
208  * @return The string describing the border mode.
209  */
210 const std::string &string_from_border_mode(BorderMode border_mode);
211 /** Translates a given normalization type to a string.
212  *
213  * @param[in] type @ref NormType to be translated to string.
214  *
215  * @return The string describing the normalization type.
216  */
217 const std::string &string_from_norm_type(NormType type);
218 /** Translates a given pooling type to a string.
219  *
220  * @param[in] type @ref PoolingType to be translated to string.
221  *
222  * @return The string describing the pooling type.
223  */
224 const std::string &string_from_pooling_type(PoolingType type);
225 /** Check if the pool region is entirely outside the input tensor
226  *
227  * @param[in] info @ref PoolingLayerInfo to be checked.
228  *
229  * @return True if the pool region is entirely outside the input tensor, False otherwise.
230  */
231 bool is_pool_region_entirely_outside_input(const PoolingLayerInfo &info);
232 /** Check if the 3d pool region is entirely outside the input tensor
233  *
234  * @param[in] info @ref Pooling3dLayerInfo to be checked.
235  *
236  * @return True if the pool region is entirely outside the input tensor, False otherwise.
237  */
238 bool is_pool_3d_region_entirely_outside_input(const Pooling3dLayerInfo &info);
239 /** Check if the 3D padding is symmetric i.e. padding in each opposite sides are euqal (left=right, top=bottom and front=back)
240  *
241  * @param[in] info @ref Padding3D input 3D padding object to check if it is symmetric
242  *
243  * @return True if padding is symmetric
244  */
245 inline bool is_symmetric(const Padding3D &info)
246 {
247  return ((info.left == info.right) && (info.top == info.bottom) && (info.front == info.back));
248 }
249 /** Translates a given GEMMLowp output stage to a string.
250  *
251  * @param[in] output_stage @ref GEMMLowpOutputStageInfo to be translated to string.
252  *
253  * @return The string describing the GEMMLowp output stage
254  */
256 /** Convert a PixelValue to a string, represented through the specific data type
257  *
258  * @param[in] value The PixelValue to convert
259  * @param[in] data_type The type to be used to convert the @p value
260  *
261  * @return String representation of the PixelValue through the given data type.
262  */
263 std::string string_from_pixel_value(const PixelValue &value, const DataType data_type);
264 
265 /** Stores padding information before configuring a kernel
266  *
267  * @param[in] infos list of tensor infos to store the padding info for
268  *
269  * @return An unordered map where each tensor info pointer is paired with its original padding info
270  */
271 std::unordered_map<const ITensorInfo *, PaddingSize> get_padding_info(std::initializer_list<const ITensorInfo *> infos);
272 /** Stores padding information before configuring a kernel
273  *
274  * @param[in] tensors list of tensors to store the padding info for
275  *
276  * @return An unordered map where each tensor info pointer is paired with its original padding info
277  */
278 std::unordered_map<const ITensorInfo *, PaddingSize> get_padding_info(std::initializer_list<const ITensor *> tensors);
279 /** Check if the previously stored padding info has changed after configuring a kernel
280  *
281  * @param[in] padding_map an unordered map where each tensor info pointer is paired with its original padding info
282  *
283  * @return true if any of the tensor infos has changed its paddings
284  */
285 bool has_padding_changed(const std::unordered_map<const ITensorInfo *, PaddingSize> &padding_map);
286 
287 /** Returns the number of elements required to go from start to end with the wanted step
288  *
289  * @param[in] start start value
290  * @param[in] end end value
291  * @param[in] step step value between each number in the wanted sequence
292  *
293  * @return number of elements to go from start value to end value using the wanted step
294  */
295 inline size_t num_of_elements_in_range(const float start, const float end, const float step)
296 {
297  ARM_COMPUTE_ERROR_ON_MSG(step == 0, "Range Step cannot be 0");
298  return size_t(std::ceil((end - start) / step));
299 }
300 
301 #ifdef ARM_COMPUTE_ASSERTS_ENABLED
302 /** Print consecutive elements to an output stream.
303  *
304  * @param[out] s Output stream to print the elements to.
305  * @param[in] ptr Pointer to print the elements from.
306  * @param[in] n Number of elements to print.
307  * @param[in] stream_width (Optional) Width of the stream. If set to 0 the element's width is used. Defaults to 0.
308  * @param[in] element_delim (Optional) Delimeter among the consecutive elements. Defaults to space delimeter
309  */
310 template <typename T>
311 void print_consecutive_elements_impl(
312  std::ostream &s, const T *ptr, unsigned int n, int stream_width = 0, const std::string &element_delim = " ")
313 {
314  using print_type = typename std::conditional<std::is_floating_point<T>::value, T, int>::type;
315  std::ios stream_status(nullptr);
316  stream_status.copyfmt(s);
317 
318  for (unsigned int i = 0; i < n; ++i)
319  {
320  // Set stream width as it is not a "sticky" stream manipulator
321  if (stream_width != 0)
322  {
323  s.width(stream_width);
324  }
325 
326  if (std::is_same<typename std::decay<T>::type, half>::value)
327  {
328  // We use T instead of print_type here is because the std::is_floating_point<half> returns false and then the print_type becomes int.
329  s << std::right << static_cast<T>(ptr[i]) << element_delim;
330  }
331  else if (std::is_same<typename std::decay<T>::type, bfloat16>::value)
332  {
333  // We use T instead of print_type here is because the std::is_floating_point<bfloat16> returns false and then the print_type becomes int.
334  s << std::right << float(ptr[i]) << element_delim;
335  }
336  else
337  {
338  s << std::right << static_cast<print_type>(ptr[i]) << element_delim;
339  }
340  }
341 
342  // Restore output stream flags
343  s.copyfmt(stream_status);
344 }
345 
346 /** Identify the maximum width of n consecutive elements.
347  *
348  * @param[in] s The output stream which will be used to print the elements. Used to extract the stream format.
349  * @param[in] ptr Pointer to the elements.
350  * @param[in] n Number of elements.
351  *
352  * @return The maximum width of the elements.
353  */
354 template <typename T>
355 int max_consecutive_elements_display_width_impl(std::ostream &s, const T *ptr, unsigned int n)
356 {
357  using print_type = typename std::conditional<std::is_floating_point<T>::value, T, int>::type;
358 
359  int max_width = -1;
360  for (unsigned int i = 0; i < n; ++i)
361  {
362  std::stringstream ss;
363  ss.copyfmt(s);
364 
365  if (std::is_same<typename std::decay<T>::type, half>::value)
366  {
367  // We use T instead of print_type here is because the std::is_floating_point<half> returns false and then the print_type becomes int.
368  ss << static_cast<T>(ptr[i]);
369  }
370  else if (std::is_same<typename std::decay<T>::type, bfloat16>::value)
371  {
372  // We use T instead of print_type here is because the std::is_floating_point<bfloat> returns false and then the print_type becomes int.
373  ss << float(ptr[i]);
374  }
375  else
376  {
377  ss << static_cast<print_type>(ptr[i]);
378  }
379 
380  max_width = std::max<int>(max_width, ss.str().size());
381  }
382  return max_width;
383 }
384 
385 /** Print consecutive elements to an output stream.
386  *
387  * @param[out] s Output stream to print the elements to.
388  * @param[in] dt Data type of the elements
389  * @param[in] ptr Pointer to print the elements from.
390  * @param[in] n Number of elements to print.
391  * @param[in] stream_width (Optional) Width of the stream. If set to 0 the element's width is used. Defaults to 0.
392  * @param[in] element_delim (Optional) Delimeter among the consecutive elements. Defaults to space delimeter
393  */
394 void print_consecutive_elements(std::ostream &s,
395  DataType dt,
396  const uint8_t *ptr,
397  unsigned int n,
398  int stream_width,
399  const std::string &element_delim = " ");
400 
401 /** Identify the maximum width of n consecutive elements.
402  *
403  * @param[in] s Output stream to print the elements to.
404  * @param[in] dt Data type of the elements
405  * @param[in] ptr Pointer to print the elements from.
406  * @param[in] n Number of elements to print.
407  *
408  * @return The maximum width of the elements.
409  */
410 int max_consecutive_elements_display_width(std::ostream &s, DataType dt, const uint8_t *ptr, unsigned int n);
411 #endif /* ARM_COMPUTE_ASSERTS_ENABLED */
412 } // namespace arm_compute
413 #endif /*ARM_COMPUTE_UTILS_H */
arm_compute::DataLayout::NCHW
@ NCHW
Num samples, channels, height, width.
DataTypeUtils.h
type
decltype(strategy::transforms) typedef type
Definition: gemm_interleaved.hpp:261
arm_compute::string_from_pooling_type
const std::string & string_from_pooling_type(PoolingType type)
Translates a given pooling type to a string.
Definition: Utils.cpp:118
arm_compute::is_pool_3d_region_entirely_outside_input
bool is_pool_3d_region_entirely_outside_input(const Pooling3dLayerInfo &info)
Check if the 3d pool region is entirely outside the input tensor.
Definition: Utils.cpp:141
arm_compute::Dimensions::set
void set(size_t dimension, T value, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
Definition: Dimensions.h:75
arm_compute::DataLayout
DataLayout
[DataLayout enum definition]
Definition: CoreTypes.h:110
arm_compute::deconvolution_output_dimensions
std::pair< unsigned int, unsigned int > deconvolution_output_dimensions(unsigned int in_width, unsigned int in_height, unsigned int kernel_width, unsigned int kernel_height, const PadStrideInfo &pad_stride_info)
Returns expected width and height of the deconvolution's output tensor.
Definition: Utils.cpp:266
arm_compute::calculate_same_pad
PadStrideInfo calculate_same_pad(TensorShape input_shape, TensorShape weights_shape, PadStrideInfo conv_info, DataLayout data_layout=DataLayout::NCHW, const Size2D &dilation=Size2D(1u, 1u), const DimensionRoundingType &rounding_type=DimensionRoundingType::FLOOR)
Calculate padding requirements in case of SAME padding.
Definition: Utils.cpp:218
arm_compute::Padding3D
Padding information for 3D operations like Conv3d.
Definition: Types.h:622
InterpolationPolicyUtils.h
arm_compute::string_from_pixel_value
std::string string_from_pixel_value(const PixelValue &value, const DataType data_type)
Convert a PixelValue to a string, represented through the specific data type.
Definition: Utils.cpp:165
arm_compute::get_quantized_activation_min_max
std::pair< int32_t, int32_t > get_quantized_activation_min_max(const ActivationLayerInfo &act_info, DataType data_type, UniformQuantizationInfo oq_info)
Returns a pair of minimum and maximum values for a quantized activation.
Definition: Utils.cpp:442
arm_compute::permute_strides
void permute_strides(Dimensions< T > &dimensions, const PermutationVector &perm)
Permutes the given dimensions according the permutation vector.
Definition: Utils.h:69
Types.h
arm_compute::is_symmetric
bool is_symmetric(const Padding3D &info)
Check if the 3D padding is symmetric i.e.
Definition: Utils.h:245
arm_compute::scaled_dimensions
std::pair< unsigned int, unsigned int > scaled_dimensions(int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info, const Size2D &dilation=Size2D(1U, 1U))
Returns expected width and height of output scaled tensor depending on dimensions rounding mode.
Definition: Utils.cpp:288
arm_compute::string_from_border_mode
const std::string & string_from_border_mode(BorderMode border_mode)
Translates a given border mode policy to a string.
Definition: Utils.cpp:96
arm_compute::DimensionRoundingType
DimensionRoundingType
Dimension rounding type when down-scaling on CNNs.
Definition: CoreTypes.h:133
Error.h
arm_compute::string_from_channel
const std::string & string_from_channel(Channel channel)
Convert a channel identity into a string.
Definition: Utils.cpp:78
arm_compute::ReductionOperation
ReductionOperation
Available reduction operations.
Definition: Types.h:408
arm_compute::read_file
std::string read_file(const std::string &filename, bool binary)
Load an entire file in memory.
Definition: Utils.cpp:40
FormatUtils.h
arm_compute::scaled_dimensions_signed
std::pair< int, int > scaled_dimensions_signed(int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info)
Returns calculated width and height of output scaled tensor depending on dimensions rounding mode.
Definition: Utils.cpp:334
arm_compute::cpu::data_layout
constexpr auto data_layout
Definition: impl.h:36
arm_compute::string_from_gemmlowp_output_stage
const std::string & string_from_gemmlowp_output_stage(GEMMLowpOutputStageType output_stage)
Translates a given GEMMLowp output stage to a string.
Definition: Utils.cpp:154
DataLayoutUtils.h
StringUtils.h
output_stage
const OutputStage & output_stage
Definition: working_space.hpp:107
arm_compute::Strides
Strides of an item in bytes.
Definition: Strides.h:38
arm_compute::test::validation::act_info
act_info
Definition: DirectConvolutionLayer.cpp:547
arm_compute::half
half_float::half half
16-bit floating point type
Definition: CoreTypes.h:36
arm_compute::utils::cast::U
U
Definition: SaturateCast.h:65
arm_compute::get_softmax_output_quantization_info
QuantizationInfo get_softmax_output_quantization_info(DataType input_type, bool is_log)
Returns output quantization information for softmax layer.
Definition: Utils.cpp:421
arm_compute::test::validation::ss
std::stringstream ss(mlgo_str)
ARM_COMPUTE_ERROR_ON_MSG
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456
arm_gemm::bfloat16
arm_compute::bfloat16 bfloat16
Definition: bfloat.hpp:30
arm_compute::string_from_norm_type
const std::string & string_from_norm_type(NormType type)
Translates a given normalization type to a string.
Definition: Utils.cpp:107
arm_compute::PoolingType
PoolingType
Available pooling types.
Definition: Types.h:480
dt
DataType dt
Definition: NEBatchNormalizationLayerKernel.cpp:50
PixelValue.h
arm_compute::Dimensions::begin
std::array< T, num_max_dimensions >::iterator begin()
Returns a read/write iterator that points to the first element in the dimension array.
Definition: Dimensions.h:214
arm_compute::Channel
Channel
Available channels.
Definition: CoreTypes.h:41
ActivationFunctionUtils.h
arm_compute::GEMMLowpOutputStageType
GEMMLowpOutputStageType
GEMMLowp output stage type.
Definition: GEMMInfo.h:36
arm_compute::test::validation::data_type
data_type
Definition: Cast.cpp:222
arm_compute::test::validation::input_shape
TensorShape input_shape
Validate test suite is to test ARM_COMPUTE_RETURN_ON_* macros we use to check the validity of given a...
Definition: LSTMLayerQuantized.cpp:466
arm_compute::DimensionRoundingType::FLOOR
@ FLOOR
Floor rounding.
arm_compute
Copyright (c) 2017-2023 Arm Limited.
Definition: introduction.dox:24
arm_compute::scaled_3d_dimensions_signed
std::tuple< int, int, int > scaled_3d_dimensions_signed(int width, int height, int depth, int kernel_width, int kernel_height, int kernel_depth, const Pooling3dLayerInfo &pool3d_info)
Returns calculated width, height and depth of output scaled tensor depending on dimensions rounding m...
Definition: Utils.cpp:366
arm_compute::test::validation::conv_info
conv_info
Definition: DirectConvolutionLayer.cpp:547
arm_compute::is_pool_region_entirely_outside_input
bool is_pool_region_entirely_outside_input(const PoolingLayerInfo &info)
Check if the pool region is entirely outside the input tensor.
Definition: Utils.cpp:129
arm_compute::num_of_elements_in_range
size_t num_of_elements_in_range(const float start, const float end, const float step)
Returns the number of elements required to go from start to end with the wanted step.
Definition: Utils.h:295
arm_compute::has_padding_changed
bool has_padding_changed(const std::unordered_map< const ITensorInfo *, PaddingSize > &padding_map)
Check if the previously stored padding info has changed after configuring a kernel.
Definition: Utils.cpp:491
arm_compute::mlgo::parser::end
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:283
arm_compute::BorderMode
BorderMode
Methods available to handle borders.
Definition: Types.h:231
arm_compute::Dimensions::end
std::array< T, num_max_dimensions >::iterator end()
Returns a read/write iterator that points one past the last element in the dimension array.
Definition: Dimensions.h:238
arm_compute::NormType
NormType
The normalization type used for the normalization layer.
Definition: Types.h:456
arm_compute::test::validation::info
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
arm_compute::cpu::step
constexpr int step
Definition: fp32.cpp:35
arm_compute::needs_serialized_reduction
bool needs_serialized_reduction(ReductionOperation op, DataType dt, unsigned int axis)
Check if the given reduction operation should be handled in a serial way.
Definition: Utils.cpp:412
arm_compute::Dimensions
Dimensions with dimensionality.
Definition: Dimensions.h:42
arm_compute::Dimensions::num_dimensions
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
Definition: Dimensions.h:142
arm_compute::DataType
DataType
Available data types.
Definition: CoreTypes.h:83
arm_compute::get_padding_info
std::unordered_map< const ITensorInfo *, PaddingSize > get_padding_info(std::initializer_list< const ITensorInfo * > infos)
Stores padding information before configuring a kernel.
Definition: Utils.cpp:476