Compute Library
 21.02
Utils.h File Reference
#include "arm_compute/core/Helpers.h"
#include "arm_compute/core/ITensor.h"
#include "arm_compute/core/Types.h"
#include "arm_compute/core/Window.h"
#include "arm_compute/runtime/Tensor.h"
#include "libnpy/npy.hpp"
#include "support/StringSupport.h"
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <memory>
#include <random>
#include <string>
#include <tuple>
#include <vector>

Go to the source code of this file.

Data Structures

class  Example
 Abstract Example class. More...
 
class  uniform_real_distribution_16bit< T >
 Specialized class to generate random non-zero FP16 values. More...
 
class  NPYLoader
 Numpy data loader. More...
 

Namespaces

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

Enumerations

enum  ImageType { UNKNOWN, PPM, JPEG }
 Supported image types. More...
 

Functions

int run_example (int argc, char **argv, std::unique_ptr< Example > example)
 Run an example and handle the potential exceptions it throws. More...
 
template<typename T >
int run_example (int argc, char **argv)
 
void draw_detection_rectangle (arm_compute::ITensor *tensor, const arm_compute::DetectionWindow &rect, uint8_t r, uint8_t g, uint8_t b)
 Draw a RGB rectangular window for the detected object. More...
 
ImageType get_image_type_from_file (const std::string &filename)
 Gets image type given a file. More...
 
std::tuple< unsigned int, unsigned int, int > parse_ppm_header (std::ifstream &fs)
 Parse the ppm header from an input file stream. More...
 
std::tuple< std::vector< unsigned long >, bool, std::string > parse_npy_header (std::ifstream &fs)
 Parse the npy header from an input file stream. More...
 
std::string get_typestring (DataType data_type)
 Obtain numpy type string from DataType. More...
 
template<typename T >
void map (T &tensor, bool blocking)
 Maps a tensor if needed. More...
 
template<typename T >
void unmap (T &tensor)
 Unmaps a tensor if needed. More...
 
template<typename T >
void save_to_ppm (T &tensor, const std::string &ppm_filename)
 Template helper function to save a tensor image to a PPM file. More...
 
template<typename T , typename U = float>
void save_to_npy (T &tensor, const std::string &npy_filename, bool fortran_order)
 Template helper function to save a tensor image to a NPY file. More...
 
template<typename T >
void load_trained_data (T &tensor, const std::string &filename)
 Load the tensor with pre-trained data from a binary file. More...
 
template<typename T , typename TensorType >
void fill_tensor_value (TensorType &tensor, T value)
 
template<typename T , typename TensorType >
void fill_tensor_zero (TensorType &tensor)
 
template<typename T , typename TensorType >
void fill_tensor_vector (TensorType &tensor, std::vector< T > vec)
 
template<typename T , typename TensorType >
void fill_random_tensor (TensorType &tensor, std::random_device::result_type seed, T lower_bound=std::numeric_limits< T >::lowest(), T upper_bound=std::numeric_limits< T >::max())
 
template<typename T , typename TensorType >
void fill_random_tensor (TensorType &tensor, T lower_bound=std::numeric_limits< T >::lowest(), T upper_bound=std::numeric_limits< T >::max())
 
template<typename T >
void init_sgemm_output (T &dst, T &src0, T &src1, arm_compute::DataType dt)
 
uint64_t get_mem_free_from_meminfo ()
 This function returns the amount of memory free reading from /proc/meminfo. More...
 
template<typename T >
int compare_tensor (ITensor &tensor1, ITensor &tensor2, T tolerance)
 Compare two tensors. More...