diff options
Diffstat (limited to 'src/core/CL')
-rw-r--r-- | src/core/CL/CLHelpers.cpp | 5 | ||||
-rw-r--r-- | src/core/CL/kernels/CLPoolingLayerKernel.cpp | 32 |
2 files changed, 35 insertions, 2 deletions
diff --git a/src/core/CL/CLHelpers.cpp b/src/core/CL/CLHelpers.cpp index 901ac3f39a..54e3e525b4 100644 --- a/src/core/CL/CLHelpers.cpp +++ b/src/core/CL/CLHelpers.cpp @@ -24,6 +24,7 @@ #include "arm_compute/core/CL/CLHelpers.h" #include "arm_compute/core/CL/CLTypes.h" #include "arm_compute/core/Error.h" +#include "arm_compute/core/Log.h" #include "arm_compute/core/Types.h" #include <map> @@ -187,7 +188,7 @@ GPUTarget get_target_from_device(cl::Device &device) if(!found_mali) { - ARM_COMPUTE_INFO("Can't find valid Mali GPU. Target is set to MIDGARD."); + ARM_COMPUTE_LOG_INFO_MSG_CORE("Can't find valid Mali GPU. Target is set to MIDGARD."); return GPUTarget::MIDGARD; } @@ -201,7 +202,7 @@ GPUTarget get_target_from_device(cl::Device &device) case 'G': return get_bifrost_target(version); default: - ARM_COMPUTE_INFO("Mali GPU unknown. Target is set to the default one."); + ARM_COMPUTE_LOG_INFO_MSG_CORE("Mali GPU unknown. Target is set to the default one."); return GPUTarget::MIDGARD; } } diff --git a/src/core/CL/kernels/CLPoolingLayerKernel.cpp b/src/core/CL/kernels/CLPoolingLayerKernel.cpp index 8b8f61e621..19d36a6ac6 100644 --- a/src/core/CL/kernels/CLPoolingLayerKernel.cpp +++ b/src/core/CL/kernels/CLPoolingLayerKernel.cpp @@ -179,6 +179,38 @@ void CLPoolingLayerKernel::configure(const ICLTensor *input, ICLTensor *output, ICLKernel::configure(win); } +Error CLPoolingLayerKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const PoolingLayerInfo &pool_info) +{ + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output); + ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QS8, DataType::QS16, DataType::F16, DataType::F32); + + int pool_pad_x = 0; + int pool_pad_y = 0; + int pool_size = pool_info.pool_size(); + std::tie(pool_pad_x, pool_pad_y) = pool_info.pad_stride_info().pad(); + ARM_COMPUTE_RETURN_ERROR_ON_MSG(((pool_pad_x >= pool_size) || (pool_pad_y >= pool_size)), + "Invalid pool size and pool pad combination"); + + // Checks performed when output is configured + if(output->total_size() != 0) + { + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output); + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_FIXED_POINT(input, output); + + unsigned int pooled_w = 0; + unsigned int pooled_h = 0; + std::tie(pooled_w, pooled_h) = scaled_dimensions(input->dimension(0), + input->dimension(1), + pool_size, + pool_size, + pool_info.pad_stride_info()); + ARM_COMPUTE_RETURN_ERROR_ON_MSG((output->dimension(0) != pooled_w) != (output->dimension(1) != pooled_h), + "Invalid output pooling dimensions!"); + } + + return Error{}; +} + void CLPoolingLayerKernel::run(const Window &window, cl::CommandQueue &queue) { ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); |