diff options
author | Sang-Hoon Park <sang-hoon.park@arm.com> | 2020-03-11 23:21:14 +0000 |
---|---|---|
committer | Michele Di Giorgio <michele.digiorgio@arm.com> | 2020-03-13 08:33:24 +0000 |
commit | 797b76b1aef38ea3be6f68ae2bf323048e9beff8 (patch) | |
tree | f78bb65ef0fe49bbb7d06225a4e7e4f2cc43cb45 /arm_compute | |
parent | 470bc1eea65560d13001e60a7f7b22b12ec89bbc (diff) | |
download | armcl-797b76b1aef38ea3be6f68ae2bf323048e9beff8.tar.gz armcl-797b76b1aef38ea3be6f68ae2bf323048e9beff8.tar.bz2 armcl-797b76b1aef38ea3be6f68ae2bf323048e9beff8.zip |
COMPMID-3221: Add EltwiseLayerDescriptor
A new descriptor struct for EltwiseLayerNode is added to have better
extendability.
Change-Id: I3d0a4b3cec1f2425f39157cee6b5c344336412a3
Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2876
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r-- | arm_compute/graph/LayerDescriptors.h | 31 | ||||
-rw-r--r-- | arm_compute/graph/nodes/EltwiseLayerNode.h | 12 |
2 files changed, 30 insertions, 13 deletions
diff --git a/arm_compute/graph/LayerDescriptors.h b/arm_compute/graph/LayerDescriptors.h index 94074e550..af69682fa 100644 --- a/arm_compute/graph/LayerDescriptors.h +++ b/arm_compute/graph/LayerDescriptors.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 ARM Limited. + * Copyright (c) 2019-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -21,10 +21,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_CONCAT_DESCRIPTOR_H -#define ARM_COMPUTE_CONCAT_DESCRIPTOR_H +#ifndef ARM_COMPUTE_LAYER_DESCRIPTORS_H +#define ARM_COMPUTE_LAYER_DESCRIPTORS_H #include "arm_compute/core/Types.h" +#include "arm_compute/graph/Types.h" namespace arm_compute { @@ -63,7 +64,29 @@ struct ConcatLayerDescriptor const DataLayoutDimension axis; /**< Concatenation Axis */ const QuantizationInfo output_qinfo; /**< Output quantizazion info */ }; + +/** Elementwise layer descriptor */ +struct EltwiseLayerDescriptor +{ + /** Constructor + * + * @param[in] op Element-wise operation to perform + * @param[in] out_quant_info (Optional) Output quantization information. Defaults to empty @ref QuantizationInfo + * @param[in] c_policy (Optional) Convert policy used for the operation. Defaults to @ref ConvertPolicy::SATURATE + * @param[in] r_policy (Optional) Rounding policy used for the operation. Defaults to @ref RoundingPolicy::TO_ZERO + */ + EltwiseLayerDescriptor(EltwiseOperation op, QuantizationInfo out_quant_info = QuantizationInfo(), ConvertPolicy c_policy = ConvertPolicy::SATURATE, RoundingPolicy r_policy = RoundingPolicy::TO_ZERO) + : op(op), out_quant_info(out_quant_info), c_policy(c_policy), r_policy(r_policy) + { + } + + EltwiseOperation op; /**< Element-wise operation to perform */ + QuantizationInfo out_quant_info; /**< Output quantization information */ + ConvertPolicy c_policy; /**< Convert policy */ + RoundingPolicy r_policy; /**< Rounding policy */ +}; + } // namespace descriptor } // namespace graph } // namespace arm_compute -#endif /* ARM_COMPUTE_CONCAT_DESCRIPTOR_H */
\ No newline at end of file +#endif /* ARM_COMPUTE_LAYER_DESCRIPTORS_H */
\ No newline at end of file diff --git a/arm_compute/graph/nodes/EltwiseLayerNode.h b/arm_compute/graph/nodes/EltwiseLayerNode.h index 1ca8e9c23..21c220a54 100644 --- a/arm_compute/graph/nodes/EltwiseLayerNode.h +++ b/arm_compute/graph/nodes/EltwiseLayerNode.h @@ -36,12 +36,9 @@ class EltwiseLayerNode final : public INode public: /** Constructor * - * @param[in] op Element-wise operation to perform - * @param[in] out_quant_info (Optional) Output quantization information - * @param[in] c_policy (Optional) Convert policy used for the operation - * @param[in] r_policy (Optional) Rounding policy used for the operation + * @param[in] descriptor Containing information for the node described in @ref descriptors::EltwiseLayerDescriptor */ - EltwiseLayerNode(EltwiseOperation op, QuantizationInfo out_quant_info = QuantizationInfo(), ConvertPolicy c_policy = ConvertPolicy::SATURATE, RoundingPolicy r_policy = RoundingPolicy::TO_ZERO); + EltwiseLayerNode(const descriptors::EltwiseLayerDescriptor &descriptor); /** Eltwise operation accessor * * @return Eltwise operation that is to be performed by the node @@ -67,10 +64,7 @@ public: void accept(INodeVisitor &v) override; private: - EltwiseOperation _op; - QuantizationInfo _out_quant_info; - ConvertPolicy _convert_policy; - RoundingPolicy _rounding_policy; + descriptors::EltwiseLayerDescriptor descriptor; }; } // namespace graph } // namespace arm_compute |