aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2017-07-12 12:30:40 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-09-17 14:16:42 +0100
commite222941f931b1d44bb29e5827b6df748e60cefc4 (patch)
tree1a54a60750caa998527e5c6b2a494047cb3ccc23 /arm_compute
parentbbd3d6045ba6480be350c0b1610048ee6c9c050f (diff)
downloadComputeLibrary-e222941f931b1d44bb29e5827b6df748e60cefc4.tar.gz
COMPMID-401: Implement FixedPointPosition conversion for NEON.
Adds support of changing the fixed point position of a tensor in DepthConvert. Change-Id: Ic3b50a4628fac7497a0217d92941c9d6f64d21cb Reviewed-on: http://mpd-gerrit.cambridge.arm.com/80438 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/core/NEON/kernels/NEDepthConvertKernel.h33
-rw-r--r--arm_compute/runtime/NEON/functions/NEDepthConvert.h21
2 files changed, 36 insertions, 18 deletions
diff --git a/arm_compute/core/NEON/kernels/NEDepthConvertKernel.h b/arm_compute/core/NEON/kernels/NEDepthConvertKernel.h
index 0c5c29e4db..ad8d152bbf 100644
--- a/arm_compute/core/NEON/kernels/NEDepthConvertKernel.h
+++ b/arm_compute/core/NEON/kernels/NEDepthConvertKernel.h
@@ -24,7 +24,7 @@
#ifndef __ARM_COMPUTE_DEPTHCONVERTKERNEL_H__
#define __ARM_COMPUTE_DEPTHCONVERTKERNEL_H__
-#include "arm_compute/core/NEON/INESimpleKernel.h"
+#include "arm_compute/core/NEON/INEKernel.h"
#include "arm_compute/core/Types.h"
#include <cstdint>
@@ -34,35 +34,52 @@ namespace arm_compute
class ITensor;
/** Depth conversion kernel */
-class NEDepthConvertKernel : public INESimpleKernel
+class NEDepthConvertKernel : public INEKernel
{
public:
/** Default constructor*/
NEDepthConvertKernel();
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ NEDepthConvertKernel(const NEDepthConvertKernel &) = delete;
+ /** Default move constructor */
+ NEDepthConvertKernel(NEDepthConvertKernel &&) = default;
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ NEDepthConvertKernel &operator=(const NEDepthConvertKernel &) = delete;
+ /** Default move assignment operator */
+ NEDepthConvertKernel &operator=(NEDepthConvertKernel &&) = default;
/** Set the input and output of the kernel
*
* Valid conversions Input -> Output :
*
- * - QS8 -> F32
+ * - QS8 -> QS8, F32
* - U8 -> U16, S16, S32
* - U16 -> U8, U32
* - S16 -> U8, S32
+ * - QS16 -> QS16, F32
* - F32 -> QS8
*
+ * @warning In case of in-place fixed point position conversion make sure that configure has been called
+ * before the updated tensor is used in other functions, as the TensorInfo of the tensor will be
+ * altered. In-place is only supported for QS8 -> QS8, QS16 -> QS16.
*
- * @param[in] input The input tensor to convert. Data types supported: U8/QS8/U16/S16/F32.
- * @param[out] output The output tensor. Data types supported: U8/QS8/U16/S16/U32/S32/F32.
- * @param[in] policy Conversion policy.
- * @param[in] shift Value for down/up conversions. Must be 0 <= shift < 8.
+ * @param[in, out] input The input tensor to convert (Written in case of in-place computation). Data types supported: U8/QS8/U16/S16/F32.
+ * @param[out] output The output tensor. Can be null in case of in-place computation. Data types supported: U8/QS8/U16/S16/U32/S32/F32.
+ * @param[in] policy Conversion policy.
+ * @param[in] shift (Optional) Value for down/up conversions. Must be 0 <= shift < 8.
+ * In case of fixed point position conversion, it specifies the new fixed point position, if operation is in-place.
*/
- void configure(const ITensor *input, ITensor *output, ConvertPolicy policy, uint32_t shift);
+ void configure(ITensor *input, ITensor *output, ConvertPolicy policy, uint32_t shift = 0);
// Inherited methods overridden:
void run(const Window &window) override;
private:
+ ITensor *_input;
+ ITensor *_output;
ConvertPolicy _policy;
uint32_t _shift;
+ int _fixed_point_position_input;
+ int _fixed_point_position_output;
};
}
#endif /*__ARM_COMPUTE_NEDEPTHCONVERTKERNEL_H__ */
diff --git a/arm_compute/runtime/NEON/functions/NEDepthConvert.h b/arm_compute/runtime/NEON/functions/NEDepthConvert.h
index 47b3a7e6f6..37f7293fb3 100644
--- a/arm_compute/runtime/NEON/functions/NEDepthConvert.h
+++ b/arm_compute/runtime/NEON/functions/NEDepthConvert.h
@@ -45,24 +45,25 @@ public:
const NEDepthConvert &operator=(const NEDepthConvert &) = delete;
/** Initialize the function's source, destination
*
- * Input format must be different than output format.
- *
* Valid conversions Input -> Output :
- * QS8 -> F32
+ * QS8 -> QS8, F32
* U8 -> U16, S16, S32
* U16 -> U8, U32
* S16 -> U8, S32
- * QS16 -> F32
+ * QS16 -> QS16, F32
* F32 -> QS8, QS16
*
+ * @warning In case of in-place fixed point position conversion make sure that configure has been called
+ * before the updated tensor is used in other functions, as the TensorInfo of the tensor will be
+ * altered. In-place is only supported for QS8 -> QS8, QS16 -> QS16.
*
- * @param[in] input The input tensor to convert. Data type supported: QS8/U8/U16/S16/QS16/F32.
- * @param[out] output The output tensor. Data type supported: QS8/U8/U16/S16/QS16/U32/S32/F32.
- * @param[in] policy Conversion policy.
- * @param[in] shift Value for down/up conversions. Must be 0 <= shift < 8.
- * It is not used on fixed point conversion.
+ * @param[in, out] input The input tensor to convert (Written in case of in-place computation). Data types supported: U8/QS8/U16/S16/F32.
+ * @param[out] output The output tensor. Can be null in case of in-place computation. Data types supported: U8/QS8/U16/S16/U32/S32/F32.
+ * @param[in] policy Conversion policy.
+ * @param[in] shift (Optional) Value for down/up conversions. Must be 0 <= shift < 8.
+ * In case of fixed point position conversion, it specifies the new fixed point position, if operation is in-place.
*/
- void configure(const ITensor *input, ITensor *output, ConvertPolicy policy, uint32_t shift);
+ void configure(ITensor *input, ITensor *output, ConvertPolicy policy, uint32_t shift = 0);
};
}
#endif /*__ARM_COMPUTE_NEDEPTHCONVERT_H__*/