Compute Library
 22.11
Utils.cpp File Reference
#include "arm_compute/core/Helpers.h"
#include "arm_compute/core/Utils.h"
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <fstream>
#include <map>
#include <string>

Go to the source code of this file.

Namespaces

 arm_compute
 Copyright (c) 2017-2022 Arm Limited.
 

Functions

std::string read_file (const std::string &filename, bool binary)
 Load an entire file in memory. More...
 
const std::string & string_from_format (Format format)
 Convert a tensor format into a string. More...
 
const std::string & string_from_channel (Channel channel)
 Convert a channel identity into a string. More...
 
const std::string & string_from_data_layout (DataLayout dl)
 Convert a data layout identity into a string. More...
 
const std::string & string_from_data_type (DataType dt)
 Convert a data type identity into a string. More...
 
const std::string & string_from_activation_func (ActivationLayerInfo::ActivationFunction act)
 Translates a given activation function to a string. More...
 
const std::string & string_from_interpolation_policy (InterpolationPolicy policy)
 Translates a given interpolation policy to a string. More...
 
const std::string & string_from_border_mode (BorderMode border_mode)
 Translates a given border mode policy to a string. More...
 
const std::string & string_from_norm_type (NormType type)
 Translates a given normalization type to a string. More...
 
const std::string & string_from_pooling_type (PoolingType type)
 Translates a given pooling type to a string. More...
 
bool is_pool_region_entirely_outside_input (const PoolingLayerInfo &info)
 Check if the pool region is entirely outside the input tensor. More...
 
bool is_pool_3d_region_entirely_outside_input (const Pooling3dLayerInfo &info)
 Check if the 3d pool region is entirely outside the input tensor. More...
 
const std::string & string_from_gemmlowp_output_stage (GEMMLowpOutputStageType output_stage)
 Translates a given GEMMLowp output stage to a string. More...
 
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. More...
 
DataType data_type_from_name (const std::string &name)
 Convert a string to DataType. More...
 
std::string lower_string (const std::string &val)
 Lower a given string. More...
 
std::string upper_string (const std::string &val)
 Raise a given string to upper case. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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 mode. More...
 
bool needs_serialized_reduction (ReductionOperation op, DataType dt, unsigned int axis)
 Check if the given reduction operation should be handled in a serial way. More...
 
QuantizationInfo get_softmax_output_quantization_info (DataType input_type, bool is_log)
 Returns output quantization information for softmax layer. More...
 
std::pair< int32_t, int32_t > get_quantized_activation_min_max (ActivationLayerInfo act_info, DataType data_type, UniformQuantizationInfo oq_info)
 Returns a pair of minimum and maximum values for a quantized activation. More...
 
std::unordered_map< const ITensorInfo *, PaddingSize > get_padding_info (std::initializer_list< const ITensor *> tensors)
 Stores padding information before configuring a kernel. More...
 
std::unordered_map< const ITensorInfo *, PaddingSize > get_padding_info (std::initializer_list< const ITensorInfo *> infos)
 Stores padding information before configuring a kernel. More...
 
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. More...