From e1651a55c637708347c9adda4a77f1deffacf7d2 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Thu, 11 Jul 2019 15:00:49 +0100 Subject: COMPMID-2414 Add add_2D_tensor_argument_if for OpenCL Change-Id: I8675b4b4face0be9416ae6c7a7023234d50fc0cb Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/1524 Comments-Addressed: Arm Jenkins Reviewed-by: Michele Di Giorgio Tested-by: Arm Jenkins --- arm_compute/core/CL/ICLKernel.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'arm_compute/core') diff --git a/arm_compute/core/CL/ICLKernel.h b/arm_compute/core/CL/ICLKernel.h index 590f8929cb..76b40b81d1 100644 --- a/arm_compute/core/CL/ICLKernel.h +++ b/arm_compute/core/CL/ICLKernel.h @@ -111,6 +111,20 @@ public: { add_tensor_argument<1>(idx, tensor, window); } + /** Add the passed 1D tensor's parameters to the object's kernel's arguments starting from the index idx if the condition is true. + * + * @param[in] cond Condition to check + * @param[in,out] idx Index at which to start adding the tensor's arguments. Will be incremented by the number of kernel arguments set. + * @param[in] tensor Tensor to set as an argument of the object's kernel. + * @param[in] window Window the kernel will be executed on. + */ + void add_1D_tensor_argument_if(bool cond, unsigned int &idx, const ICLTensor *tensor, const Window &window) + { + if(cond) + { + add_1D_tensor_argument(idx, tensor, window); + } + } /** Add the passed 2D tensor's parameters to the object's kernel's arguments starting from the index idx. * * @param[in,out] idx Index at which to start adding the tensor's arguments. Will be incremented by the number of kernel arguments set. @@ -121,6 +135,20 @@ public: { add_tensor_argument<2>(idx, tensor, window); } + /** Add the passed 2D tensor's parameters to the object's kernel's arguments starting from the index idx if the condition is true. + * + * @param[in] cond Condition to check + * @param[in,out] idx Index at which to start adding the tensor's arguments. Will be incremented by the number of kernel arguments set. + * @param[in] tensor Tensor to set as an argument of the object's kernel. + * @param[in] window Window the kernel will be executed on. + */ + void add_2D_tensor_argument_if(bool cond, unsigned int &idx, const ICLTensor *tensor, const Window &window) + { + if(cond) + { + add_2D_tensor_argument(idx, tensor, window); + } + } /** Add the passed 3D tensor's parameters to the object's kernel's arguments starting from the index idx. * * @param[in,out] idx Index at which to start adding the tensor's arguments. Will be incremented by the number of kernel arguments set. -- cgit v1.2.1