Compute Library
 21.08
Utils.h File Reference
#include "arm_compute/core/Coordinates.h"
#include "arm_compute/core/Error.h"
#include "arm_compute/core/Size2D.h"
#include "arm_compute/core/TensorInfo.h"
#include "arm_compute/core/TensorShape.h"
#include "arm_compute/core/Types.h"
#include "support/StringSupport.h"
#include "support/ToolchainSupport.h"
#include <cmath>
#include <cstddef>
#include <limits>
#include <memory>
#include <random>
#include <sstream>
#include <string>
#include <type_traits>
#include <vector>
#include "arm_compute/runtime/CPP/CPPScheduler.h"
#include "arm_compute/runtime/RuntimeContext.h"

Go to the source code of this file.

Data Structures

struct  promote< T >
 Promote a type. More...
 
struct  promote< uint8_t >
 Promote uint8_t to uint16_t. More...
 
struct  promote< int8_t >
 Promote int8_t to int16_t. More...
 
struct  promote< uint16_t >
 Promote uint16_t to uint32_t. More...
 
struct  promote< int16_t >
 Promote int16_t to int32_t. More...
 
struct  promote< uint32_t >
 Promote uint32_t to uint64_t. More...
 
struct  promote< int32_t >
 Promote int32_t to int64_t. More...
 
struct  promote< float >
 Promote float to float. More...
 
struct  promote< half >
 Promote half to half. More...
 
struct  common_promoted_signed_type< T >
 Find the signed promoted common type. More...
 
struct  common_promoted_unsigned_type< T >
 Find the unsigned promoted common type. More...
 

Namespaces

 arm_compute
 Copyright (c) 2017-2021 Arm Limited.
 
 arm_compute::test
 
 arm_compute::test::traits
 

Typedefs

template<typename T >
using promote_t = typename promote< T >::type
 Get promoted type. More...
 
template<typename T >
using make_signed_conditional_t = typename std::conditional< std::is_integral< T >::value, std::make_signed< T >, std::common_type< T > >::type
 
template<typename T >
using make_unsigned_conditional_t = typename std::conditional< std::is_integral< T >::value, std::make_unsigned< T >, std::common_type< T > >::type
 

Functions

template<typename T , typename = typename std::enable_if<std::is_floating_point<T>::value>::type>
round_half_up (T value)
 Round floating-point value with half value rounding to positive infinity. More...
 
template<typename T , typename = typename std::enable_if<std::is_floating_point<T>::value>::type>
round_half_even (T value, T epsilon=std::numeric_limits< T >::epsilon())
 Round floating-point value with half value rounding to nearest even. More...
 
Format get_format_for_channel (Channel channel)
 Look up the format corresponding to a channel. More...
 
Format get_channel_format (Channel channel)
 Return the format of a channel. More...
 
template<typename F , typename T >
foldl (F &&, const T &value)
 Base case of foldl. More...
 
template<typename F , typename T , typename U >
auto foldl (F &&func, T &&value1, U &&value2) -> decltype(func(value1, value2))
 Base case of foldl. More...
 
template<typename F , typename I , typename T , typename... Vs>
foldl (F &&func, I &&initial, T &&value, Vs &&... values)
 Fold left. More...
 
ValidRegion shape_to_valid_region (const TensorShape &a_shape, bool border_undefined=false, BorderSize border_size=BorderSize(0))
 Create a valid region based on tensor shape, border mode and border size. More...
 
template<typename T >
void store_value_with_data_type (void *ptr, T value, DataType data_type)
 Write the value after casting the pointer according to data_type. More...
 
template<typename U , typename T >
saturate_cast (T val)
 Saturate a value of type T against the numeric limits of type U. More...
 
Coordinates index2coord (const TensorShape &shape, int index)
 Convert a linear index into n-dimensional coordinates. More...
 
int coord2index (const TensorShape &shape, const Coordinates &coord)
 Linearise the given coordinate. More...
 
bool is_in_valid_region (const ValidRegion &valid_region, Coordinates coord)
 Check if a coordinate is within a valid region. More...
 
template<typename T >
create_tensor (const TensorInfo &info, IRuntimeContext *ctx=nullptr)
 Create and initialize a tensor of the given type. More...
 
template<typename T >
create_tensor (const TensorShape &shape, DataType data_type, int num_channels=1, QuantizationInfo quantization_info=QuantizationInfo(), DataLayout data_layout=DataLayout::NCHW, IRuntimeContext *ctx=nullptr)
 Create and initialize a tensor of the given type. More...
 
template<typename T >
create_tensor (const TensorShape &shape, Format format, IRuntimeContext *ctx=nullptr)
 Create and initialize a tensor of the given type. More...
 
template<typename T , typename = typename std::enable_if<std::is_floating_point<T>::value>::type>
std::vector< T > generate_random_real (unsigned int num_values, T min, T max, std::random_device::result_type seed)
 Create a vector with a uniform distribution of floating point values across the specified range. More...
 
template<typename T , typename ArrayAccessor_T >
void fill_array (ArrayAccessor_T &&array, const std::vector< T > &v)
 
std::string get_typestring (DataType data_type)
 Obtain numpy type string from DataType. More...
 
template<typename TensorType >
void sync_if_necessary ()
 Sync if necessary. More...
 
template<typename TensorType >
void sync_tensor_if_necessary (TensorType &tensor)
 Sync tensor if necessary. More...
 
ITensorInfo::TensorDimsState construct_dims_state (int32_t value)
 Construct and return object for dimensions' state filled with the given value. More...
 
ITensorInfo::TensorDimsState construct_dynamic_dims_state ()
 Construct and return object for dimensions' state filled with the value for dynamic state. More...
 
ITensorInfo::TensorDimsState construct_static_dims_state ()
 Construct and return object for dimensions' state filled with the value for non-dynamic state. More...
 
template<typename TensorType >
void set_tensor_dynamic (TensorType &t)
 Set the dimension states of the given tensor to dynamic. More...
 
template<typename TensorType >
void set_tensor_static (TensorType &t)
 Set the dimension states of the given tensor to state. More...