Basic function to pad a tensor. This function calls the following OpenCL functions/kernels: * * -# CLPadLayerKernel if there is padding to be added * -# @ref CLCopy otherwise */
| 46 | * -# @ref CLCopy otherwise |
| 47 | */ |
| 48 | class CLPadLayer : public IFunction |
| 49 | { |
| 50 | public: |
| 51 | /** Default constructor */ |
| 52 | CLPadLayer(); |
| 53 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 54 | CLPadLayer(const CLPadLayer &) = delete; |
| 55 | /** Default move constructor */ |
| 56 | CLPadLayer(CLPadLayer &&) = default; |
| 57 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 58 | CLPadLayer &operator=(const CLPadLayer &) = delete; |
| 59 | /** Default move assignment operator */ |
| 60 | CLPadLayer &operator=(CLPadLayer &&) = default; |
| 61 | /** Default destructor */ |
| 62 | ~CLPadLayer(); |
| 63 | |
| 64 | /** Initialize the function |
| 65 | * |
| 66 | * Valid data layouts: |
| 67 | * - NHWC |
| 68 | * - NCHW |
| 69 | * |
| 70 | * Valid data type configurations: |
| 71 | * |src |dst | |
| 72 | * |:--------|:---------| |
| 73 | * |All |All | |
| 74 | * |
| 75 | * @param[in] input Source tensor. Data types supported: All. |
| 76 | * @param[out] output Output tensor. Data type supported: same as @p input |
| 77 | * @param[in] padding The padding for each spatial dimension of the input tensor. The pair padding[i] |
| 78 | * specifies the front and the end padding in the i-th dimension. |
| 79 | * @param[in] constant_value (Optional) Constant value to be used for the padding. |
| 80 | * @param[in] mode (Optional) Controls whether the padding should be filled with @p constant_value using CONSTANT, |
| 81 | * or reflect the input, either including the border values (SYMMETRIC) or not (REFLECT). |
| 82 | */ |
| 83 | void configure(ICLTensor *input, |
| 84 | ICLTensor *output, |
| 85 | const PaddingList &padding, |
| 86 | PixelValue constant_value = PixelValue(), |
| 87 | PaddingMode mode = PaddingMode::CONSTANT); |
| 88 | /** Initialize the function |
| 89 | * |
| 90 | * @param[in] compile_context The compile context to be used. |
| 91 | * @param[in] input Source tensor. Data types supported: All. |
| 92 | * @param[out] output Output tensor. Data type supported: same as @p input |
| 93 | * @param[in] padding The padding for each spatial dimension of the input tensor. The pair padding[i] |
| 94 | * specifies the front and the end padding in the i-th dimension. |
| 95 | * @param[in] constant_value (Optional) Constant value to be used for the padding. |
| 96 | * @param[in] mode (Optional) Controls whether the padding should be filled with @p constant_value using CONSTANT, |
| 97 | * or reflect the input, either including the border values (SYMMETRIC) or not (REFLECT). |
| 98 | */ |
| 99 | void configure(const CLCompileContext &compile_context, |
| 100 | ICLTensor *input, |
| 101 | ICLTensor *output, |
| 102 | const PaddingList &padding, |
| 103 | PixelValue constant_value = PixelValue(), |
| 104 | PaddingMode mode = PaddingMode::CONSTANT); |
| 105 |