diff options
author | Anthony Barbier <anthony.barbier@arm.com> | 2017-10-26 15:23:08 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | 7068f9900d136312318ff430aef588b14e0c87ad (patch) | |
tree | b57ca81231860f1d8755e6f18e5be7c959fb60c6 /utils/Utils.h | |
parent | d60737592736715dcfd0520535c48190d4ac77d2 (diff) | |
download | ComputeLibrary-7068f9900d136312318ff430aef588b14e0c87ad.tar.gz |
COMPMID-631: Merge branches/gles_compute branch
Last commit:
commit b25c5f68042b0c81bf611d59a1bb8535e1c42497
Author: Xinghang Zhou <xinghang.zhou@arm.com>
Date: Wed Oct 25 18:48:10 2017 +0800
Synced validation's tolerances of GCSoftmax from cl side
Change-Id: Ibe72054205c1c8721845d679a31af7ed0a7c5cf6
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/93283
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'utils/Utils.h')
-rw-r--r-- | utils/Utils.h | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/utils/Utils.h b/utils/Utils.h index 28382f47e4..76329671af 100644 --- a/utils/Utils.h +++ b/utils/Utils.h @@ -37,6 +37,9 @@ #include "arm_compute/core/CL/OpenCL.h" #include "arm_compute/runtime/CL/CLTensor.h" #endif /* ARM_COMPUTE_CL */ +#ifdef ARM_COMPUTE_GC +#include "arm_compute/runtime/GLES_COMPUTE/GCTensor.h" +#endif /* ARM_COMPUTE_GC */ #include <cstdlib> #include <cstring> @@ -188,6 +191,27 @@ inline void unmap(CLTensor &tensor) } #endif /* ARM_COMPUTE_CL */ +#ifdef ARM_COMPUTE_GC +/** Maps a tensor if needed + * + * @param[in] tensor Tensor to be mapped + * @param[in] blocking Specified if map is blocking or not + */ +inline void map(GCTensor &tensor, bool blocking) +{ + tensor.map(blocking); +} + +/** Unmaps a tensor if needed + * + * @param tensor Tensor to be unmapped + */ +inline void unmap(GCTensor &tensor) +{ + tensor.unmap(); +} +#endif /* ARM_COMPUTE_GC */ + /** Class to load the content of a PPM file into an Image */ class PPMLoader @@ -256,7 +280,7 @@ public: ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN(&image, arm_compute::Format::U8, arm_compute::Format::RGB888); try { - // Map buffer if creating a CLTensor + // Map buffer if creating a CLTensor/GCTensor map(image, true); // Check if the file is large enough to fill the image @@ -319,7 +343,7 @@ public: ARM_COMPUTE_ERROR("Unsupported format"); } - // Unmap buffer if creating a CLTensor + // Unmap buffer if creating a CLTensor/GCTensor unmap(image); } catch(const std::ifstream::failure &e) @@ -610,7 +634,7 @@ void save_to_ppm(T &tensor, const std::string &ppm_filename) fs << "P6\n" << width << " " << height << " 255\n"; - // Map buffer if creating a CLTensor + // Map buffer if creating a CLTensor/GCTensor map(tensor, true); switch(tensor.info()->format()) @@ -653,7 +677,7 @@ void save_to_ppm(T &tensor, const std::string &ppm_filename) ARM_COMPUTE_ERROR("Unsupported format"); } - // Unmap buffer if creating a CLTensor + // Unmap buffer if creating a CLTensor/GCTensor unmap(tensor); } catch(const std::ofstream::failure &e) @@ -762,7 +786,7 @@ void load_trained_data(T &tensor, const std::string &filename) throw std::runtime_error("Could not load binary data: " + filename); } - // Map buffer if creating a CLTensor + // Map buffer if creating a CLTensor/GCTensor map(tensor, true); Window window; @@ -782,10 +806,8 @@ void load_trained_data(T &tensor, const std::string &filename) }, in); -#ifdef ARM_COMPUTE_CL - // Unmap buffer if creating a CLTensor + // Unmap buffer if creating a CLTensor/GCTensor unmap(tensor); -#endif /* ARM_COMPUTE_CL */ } catch(const std::ofstream::failure &e) { |