Compute Library
18.05
|
Namespaces | |
cast | |
iterable | |
signal | |
Data Structures | |
class | Example |
Abstract Example class. More... | |
class | NPYLoader |
Numpy data loader. More... | |
class | PPMLoader |
Class to load the content of a PPM file into an Image. 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... | |
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... | |
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... | |
uint64_t | get_mem_free_from_meminfo () |
This function returns the amount of memory free reading from /proc/meminfo. More... | |
template<typename T > | |
int | run_example (int argc, char **argv) |
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 > | |
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 > | |
void | fill_random_tensor (T &tensor, float lower_bound, float upper_bound) |
template<typename T > | |
void | init_sgemm_output (T &dst, T &src0, T &src1, arm_compute::DataType dt) |
template<typename T > | |
int | compare_tensor (ITensor &tensor1, ITensor &tensor2) |
Compare to tensor. More... | |
Compare to tensor.
[in] | tensor1 | First tensor to be compared. |
[in] | tensor2 | Second tensor to be compared. |
Definition at line 936 of file Utils.h.
References arm_compute::test::fixed_point_arithmetic::detail::abs(), ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES, ARM_COMPUTE_ERROR_ON_MISMATCHING_SHAPES, arm_compute::execute_window_loop(), ITensor::info(), map(), Iterator::ptr(), ITensorInfo::tensor_shape(), unmap(), and Window::use_tensor_dimensions().
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.
[in,out] | tensor | Input tensor where the rectangle will be drawn on. Format supported: RGB888 |
[in] | rect | Geometry of the rectangular window |
[in] | r | Red colour to use |
[in] | g | Green colour to use |
[in] | b | Blue colour to use |
Definition at line 107 of file Utils.cpp.
References ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN, arm_compute::test::validation::b, ITensor::buffer(), Window::DimY, DetectionWindow::height, ITensor::info(), ITensorInfo::offset_element_in_bytes(), arm_compute::RGB888, ITensorInfo::strides_in_bytes(), DetectionWindow::width, DetectionWindow::x, and DetectionWindow::y.
Referenced by run_example().
void arm_compute::utils::fill_random_tensor | ( | T & | tensor, |
float | lower_bound, | ||
float | upper_bound | ||
) |
Definition at line 882 of file Utils.h.
References ARM_COMPUTE_ERROR, arm_compute::execute_window_loop(), arm_compute::F32, map(), Iterator::ptr(), unmap(), and Window::use_tensor_dimensions().
uint64_t get_mem_free_from_meminfo | ( | ) |
This function returns the amount of memory free reading from /proc/meminfo.
Definition at line 199 of file Utils.cpp.
References arm_compute::test::fixed_point_arithmetic::detail::max().
Referenced by init_sgemm_output().
|
inline |
Obtain numpy type string from DataType.
[in] | data_type | Data type. |
Definition at line 128 of file Utils.h.
References ARM_COMPUTE_ERROR, arm_compute::test::validation::c, arm_compute::F32, arm_compute::F64, arm_compute::QASYMM8, arm_compute::S16, arm_compute::S32, arm_compute::S64, arm_compute::S8, arm_compute::SIZET, arm_compute::support::cpp11::to_string(), arm_compute::U16, arm_compute::U32, arm_compute::U64, and arm_compute::U8.
Referenced by NumPyBinLoader::access_tensor(), and NPYLoader::fill_tensor().
void arm_compute::utils::init_sgemm_output | ( | T & | dst, |
T & | src0, | ||
T & | src1, | ||
arm_compute::DataType | dt | ||
) |
Definition at line 918 of file Utils.h.
References get_mem_free_from_meminfo().
void arm_compute::utils::load_trained_data | ( | T & | tensor, |
const std::string & | filename | ||
) |
Load the tensor with pre-trained data from a binary file.
[in] | tensor | The tensor to be filled. Data type supported: F32. |
[in] | filename | Filename of the binary file to load from. |
Definition at line 835 of file Utils.h.
References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, Window::DimX, arm_compute::execute_window_loop(), arm_compute::F32, map(), Iterator::ptr(), Window::set(), and unmap().
|
inline |
Maps a tensor if needed.
[in] | tensor | Tensor to be mapped |
[in] | blocking | Specified if map is blocking or not |
Definition at line 180 of file Utils.h.
References ARM_COMPUTE_UNUSED.
Referenced by compare_tensor(), PPMLoader::fill_image(), PPMLoader::fill_planar_tensor(), fill_random_tensor(), NPYLoader::fill_tensor(), load_trained_data(), save_to_npy(), save_to_ppm(), and unmap().
std::tuple< std::vector< unsigned long >, bool, std::string > parse_npy_header | ( | std::ifstream & | fs | ) |
Parse the npy header from an input file stream.
At the end of the execution, the file position pointer will be located at the first pixel stored in the npy file
[in] | fs | Input file stream to parse |
Definition at line 175 of file Utils.cpp.
References arm_compute::test::validation::shape.
Referenced by NPYLoader::open(), and run_example().
std::tuple< unsigned int, unsigned int, int > parse_ppm_header | ( | std::ifstream & | fs | ) |
Parse the ppm header from an input file stream.
At the end of the execution, the file position pointer will be located at the first pixel stored in the ppm file
[in] | fs | Input file stream to parse |
Definition at line 144 of file Utils.cpp.
References ARM_COMPUTE_ERROR_ON_MSG, and ARM_COMPUTE_UNUSED.
Referenced by PPMLoader::open(), and run_example().
int run_example | ( | int | argc, |
char ** | argv, | ||
std::unique_ptr< Example > | example | ||
) |
Run an example and handle the potential exceptions it throws.
[in] | argc | Number of command line arguments |
[in] | argv | Command line arguments |
[in] | example | Example to run |
Definition at line 70 of file Utils.cpp.
Referenced by Example::do_teardown(), and run_example().
int arm_compute::utils::run_example | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 89 of file Utils.h.
References arm_compute::test::validation::b, draw_detection_rectangle(), parse_npy_header(), parse_ppm_header(), and run_example().
void arm_compute::utils::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.
[in] | tensor | The tensor to save as NPY file |
[in] | npy_filename | Filename of the file to create. |
[in] | fortran_order | If true, save matrix in fortran order. |
Definition at line 763 of file Utils.h.
References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_DATA_TYPE_NOT_IN, Window::DimX, Window::DimY, arm_compute::execute_window_loop(), arm_compute::F32, map(), Iterator::ptr(), Window::set(), arm_compute::test::validation::shape, and unmap().
void arm_compute::utils::save_to_ppm | ( | T & | tensor, |
const std::string & | ppm_filename | ||
) |
Template helper function to save a tensor image to a PPM file.
[in] | tensor | The tensor to save as PPM file |
[in] | ppm_filename | Filename of the file to create. |
Definition at line 682 of file Utils.h.
References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN, Window::DimX, Window::DimY, arm_compute::execute_window_loop(), map(), Iterator::ptr(), arm_compute::RGB888, Window::set(), arm_compute::U8, and unmap().
Referenced by PPMWriter::access_tensor().
|
inline |
Unmaps a tensor if needed.
tensor | Tensor to be unmapped |
Definition at line 191 of file Utils.h.
References ARM_COMPUTE_UNUSED, CLTensor::map(), CLDistribution1D::map(), GCTensor::map(), map(), CLTensor::unmap(), CLDistribution1D::unmap(), and GCTensor::unmap().
Referenced by compare_tensor(), PPMLoader::fill_image(), PPMLoader::fill_planar_tensor(), fill_random_tensor(), NPYLoader::fill_tensor(), load_trained_data(), save_to_npy(), and save_to_ppm().