aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorJohn Kesapides <john.kesapides@arm.com>2019-03-04 16:29:22 +0000
committerPablo Marquez <pablo.tello@arm.com>2019-03-13 13:34:48 +0000
commitadfb2737046028c042f0aecaff87733a442da29f (patch)
tree23b08fb9529075277e51dc1ae7e6489f690c9698 /arm_compute
parent381fcf20c3ee028e14c154ff4b75bc7410f91168 (diff)
downloadComputeLibrary-adfb2737046028c042f0aecaff87733a442da29f.tar.gz
COMPMID-1935 Add support for QASYMM8 in NEQuantizeLayer
Change-Id: I2b63a644d8e34f91c830d9ac398debcbdca3e497 Signed-off-by: John Kesapides <john.kesapides@arm.com> Reviewed-on: https://review.mlplatform.org/c/829 Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/core/NEON/kernels/NEQuantizationLayerKernel.h24
-rw-r--r--arm_compute/runtime/NEON/functions/NEQuantizationLayer.h27
2 files changed, 19 insertions, 32 deletions
diff --git a/arm_compute/core/NEON/kernels/NEQuantizationLayerKernel.h b/arm_compute/core/NEON/kernels/NEQuantizationLayerKernel.h
index ca7658bb7e..391a72c6db 100644
--- a/arm_compute/core/NEON/kernels/NEQuantizationLayerKernel.h
+++ b/arm_compute/core/NEON/kernels/NEQuantizationLayerKernel.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -54,32 +54,30 @@ public:
NEQuantizationLayerKernel &operator=(NEQuantizationLayerKernel &&) = default;
/** Default destructor */
~NEQuantizationLayerKernel() = default;
- /** Set the input, output, min and max.
+ /** Set the input, output.
*
- * @param[in] input Source tensor with at least 3 dimensions. The dimensions over the third will be interpreted as batches. Data types supported: F32.
- * @param[out] output Destination tensor with the same dimensions of input. Data types supported: U8.
- * @param[in] min_max Pointer to the tensor with shape [2, batches] which stores the minimum and maximum value for each 3D input tensor.
- * The dimensions over the second must match the batched dimensions of the input tensor. Data type supported: F32
+ * @param[in] input Source tensor. The dimensions over the third will be interpreted as batches. Data types supported: F32/F16.
+ * @param[out] output Destination tensor with the same dimensions of input. Data types supported: QASYMM8.
*/
- void configure(const ITensor *input, ITensor *output, const ITensor *min_max);
+ void configure(const ITensor *input, ITensor *output);
/** Static function to check if given info will lead to a valid configuration of @ref NEQuantizationLayerKernel
*
- * @param[in] input Input tensor info. Data types supported: F32.
- * @param[in] output Output tensor info. Data types supported: U8.
- * @param[in] min_max Info for the tensor with shape [2, batches] which stores the minimum and maximum value for each 3D input tensor.
- * The dimensions over the second must match the batched dimensions of the input tensor. Data type supported: F32.
+ * @param[in] input Input tensor info. Data types supported: F32/F16.
+ * @param[in] output Output tensor info. Data types supported: QASYMM8.
*
* @return a status
*/
- static Status validate(const ITensorInfo *input, const ITensorInfo *output, const ITensorInfo *min_max);
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output);
// Inherited methods overridden:
void run(const Window &window, const ThreadInfo &info) override;
private:
+ template <typename T>
+ void quantize(const Window &window, const QuantizationInfo &qinfo);
+
const ITensor *_input;
ITensor *_output;
- const ITensor *_min_max;
};
} // namespace arm_compute
#endif /*__ARM_COMPUTE_NEQUANTIZATIONLAYERKERNEL_H__ */
diff --git a/arm_compute/runtime/NEON/functions/NEQuantizationLayer.h b/arm_compute/runtime/NEON/functions/NEQuantizationLayer.h
index 9cc1666b4c..9ca199d1ee 100644
--- a/arm_compute/runtime/NEON/functions/NEQuantizationLayer.h
+++ b/arm_compute/runtime/NEON/functions/NEQuantizationLayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -26,9 +26,8 @@
#include "arm_compute/runtime/IFunction.h"
-#include "arm_compute/core/NEON/kernels/NEMinMaxLayerKernel.h"
#include "arm_compute/core/NEON/kernels/NEQuantizationLayerKernel.h"
-#include "arm_compute/runtime/Tensor.h"
+#include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h"
#include "arm_compute/core/Types.h"
@@ -38,39 +37,29 @@ class ITensor;
/** Basic function to simulate a quantization layer. This function calls the following NEON kernels:
*
- * @note The implementation supports only 3D input tensors
*
- * -# @ref NEMinMaxLayerKernel
* -# @ref NEQuantizationLayerKernel
*
*/
-class NEQuantizationLayer : public IFunction
+class NEQuantizationLayer : public INESimpleFunctionNoBorder
{
public:
/** Default constructor */
- NEQuantizationLayer();
+ NEQuantizationLayer() = default;
/** Set the input and output tensors.
*
- * @param[in] input Source tensor with at least 3 dimensions. The dimensions over the third will be interpreted as batches. Data types supported: F32
- * @param[out] output Destination tensor with the same dimensions of input. Data types supported: U8
+ * @param[in] input Source tensor. The dimensions over the third will be interpreted as batches. Data types supported: F32
+ * @param[out] output Destination tensor with the same dimensions of input. Data types supported: QASYMM8
*/
void configure(const ITensor *input, ITensor *output);
/** Static function to check if given info will lead to a valid configuration of @ref NEQuantizationLayer
*
* @param[in] input Input tensor info. The dimensions over the third will be interpreted as batches. Data types supported: F32.
- * @param[in] output Output tensor info. Data types supported: U8
+ * @param[in] output Output tensor info. Data types supported: QASYMM8
*
* @return a status
*/
static Status validate(const ITensorInfo *input, const ITensorInfo *output);
-
- // Inherited methods overridden:
- void run() override;
-
-private:
- NEQuantizationLayerKernel _quantize_kernel;
- NEMinMaxLayerKernel _min_max_kernel;
- Tensor _min_max;
};
-}
+} // namespace arm_compute
#endif /* __ARM_COMPUTE_NEQUANTIZATIONLAYER_H__ */