aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorManuel Bottini <manuel.bottini@arm.com>2018-12-10 17:40:23 +0000
committerManuel Bottini <manuel.bottini@arm.com>2019-01-14 13:53:11 +0000
commitb412fab0e3c8ec10e104f4d85760898a5b26179c (patch)
treee0cd062cdd32e78db3e2e67bcdb39e7efab6dff5 /arm_compute
parent1c9efebf4344e8db97e6d9282b2bf48b52090b58 (diff)
downloadComputeLibrary-b412fab0e3c8ec10e104f4d85760898a5b26179c.tar.gz
COMPMID-1724: CL Implement Prod
Change-Id: I17e51f25064b53a8f7e13d6fcbecc14a192de103 Reviewed-on: https://review.mlplatform.org/387 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/PixelValue.h50
-rw-r--r--arm_compute/core/Types.h9
-rw-r--r--arm_compute/runtime/CL/functions/CLReductionOperation.h8
3 files changed, 58 insertions, 9 deletions
diff --git a/arm_compute/core/PixelValue.h b/arm_compute/core/PixelValue.h
index 530cc166a2..e86eeba121 100644
--- a/arm_compute/core/PixelValue.h
+++ b/arm_compute/core/PixelValue.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -39,6 +39,54 @@ public:
: value{ uint64_t(0) }
{
}
+ /** Initialize the union with a pixel value of chosen datatype
+ *
+ * @param[in] v int value.
+ * @param[in] datatype DataType that @p v have to be stored
+ */
+ PixelValue(uint64_t v, DataType datatype)
+ : PixelValue()
+ {
+ switch(datatype)
+ {
+ case DataType::U8:
+ value.u8 = static_cast<uint8_t>(v);
+ break;
+ case DataType::S8:
+ value.s8 = static_cast<int8_t>(v);
+ break;
+ case DataType::U16:
+ value.u16 = static_cast<uint16_t>(v);
+ break;
+ case DataType::S16:
+ value.s16 = static_cast<int16_t>(v);
+ break;
+ case DataType::U32:
+ value.u32 = static_cast<uint32_t>(v);
+ break;
+ case DataType::S32:
+ value.s32 = static_cast<int32_t>(v);
+ break;
+ case DataType::U64:
+ value.u64 = static_cast<uint64_t>(v);
+ break;
+ case DataType::S64:
+ value.s16 = static_cast<int64_t>(v);
+ break;
+ case DataType::F16:
+ value.f16 = static_cast<half>(v);
+ break;
+ case DataType::F32:
+ value.f32 = static_cast<float>(v);
+ break;
+ case DataType::F64:
+ value.f64 = static_cast<double>(v);
+ break;
+ default:
+ value.u64 = v;
+ break;
+ }
+ }
/** Initialize the union with a U8 pixel value
*
* @param[in] v U8 value.
diff --git a/arm_compute/core/Types.h b/arm_compute/core/Types.h
index dc87617f55..317c8990fa 100644
--- a/arm_compute/core/Types.h
+++ b/arm_compute/core/Types.h
@@ -538,11 +538,12 @@ enum class NonLinearFilterFunction : unsigned
/** Available reduction operations */
enum class ReductionOperation
{
- SUM_SQUARE, /**< Sum of squares */
- SUM, /**< Sum */
- MEAN_SUM, /**< Mean of sum */
ARG_IDX_MAX, /**< Index of the max value */
- ARG_IDX_MIN /**< Index of the min value */
+ ARG_IDX_MIN, /**< Index of the min value */
+ MEAN_SUM, /**< Mean of sum */
+ PROD, /**< Product */
+ SUM_SQUARE, /**< Sum of squares */
+ SUM /**< Sum */
};
/** Available element-wise operations */
diff --git a/arm_compute/runtime/CL/functions/CLReductionOperation.h b/arm_compute/runtime/CL/functions/CLReductionOperation.h
index ac35b7bfc6..977562d993 100644
--- a/arm_compute/runtime/CL/functions/CLReductionOperation.h
+++ b/arm_compute/runtime/CL/functions/CLReductionOperation.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -76,12 +76,12 @@ public:
private:
CLMemoryGroup _memory_group;
- std::unique_ptr<CLTensor[]> _sums_vector{ nullptr };
+ std::unique_ptr<CLTensor[]> _results_vector{ nullptr };
std::unique_ptr<CLReductionOperationKernel[]> _reduction_kernels_vector{ nullptr };
std::unique_ptr<CLFillBorderKernel[]> _border_handlers_vector{ nullptr };
unsigned int _num_of_stages;
unsigned int _reduction_axis;
- bool _is_quantized;
+ bool _is_serial;
};
-}
+} // namespace arm_compute
#endif /*__ARM_COMPUTE_CLREDUCTIONOPERATION_H__ */