diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2021-08-03 08:24:00 +0100 |
---|---|---|
committer | Sheri Zhang <sheri.zhang@arm.com> | 2021-08-04 08:56:33 +0000 |
commit | 4164814a099773c0a512889473c980bc148e590f (patch) | |
tree | 7ee27bbd40724635f5bf22bc9ec28b3a1a4d1ac9 /arm_compute | |
parent | 6e90c12e3067c482524a08bf322f42de6d9d27b9 (diff) | |
download | ComputeLibrary-4164814a099773c0a512889473c980bc148e590f.tar.gz |
Implement Operator API
Resolves: COMPMID-4512
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Change-Id: Id12130365fa3fe2261160931dcc7affb6b467186
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6031
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r-- | arm_compute/Acl.hpp | 19 | ||||
-rw-r--r-- | arm_compute/AclDescriptors.h | 9 |
2 files changed, 24 insertions, 4 deletions
diff --git a/arm_compute/Acl.hpp b/arm_compute/Acl.hpp index 7791c5633e..55e04e876d 100644 --- a/arm_compute/Acl.hpp +++ b/arm_compute/Acl.hpp @@ -87,6 +87,7 @@ OBJECT_DELETER(AclContext, AclDestroyContext) OBJECT_DELETER(AclQueue, AclDestroyQueue) OBJECT_DELETER(AclTensor, AclDestroyTensor) OBJECT_DELETER(AclTensorPack, AclDestroyTensorPack) +OBJECT_DELETER(AclOperator, AclDestroyOperator) #undef OBJECT_DELETER @@ -773,6 +774,24 @@ protected: /** Constructor */ Operator() = default; }; + +/// Operators +using ActivationDesc = AclActivationDescriptor; +class Activation : public Operator +{ +public: + Activation(Context &ctx, const TensorDescriptor &src, const TensorDescriptor &dst, const ActivationDesc &desc, StatusCode *status = nullptr) + { + AclOperator op; + const auto st = detail::as_enum<StatusCode>(AclActivation(&op, ctx.get(), src.get(), dst.get(), desc)); + reset(op); + report_status(st, "[Compute Library] Failure during Activation operator creation"); + if(status) + { + *status = st; + } + } +}; } // namespace acl #undef ARM_COMPUTE_IGNORE_UNUSED #endif /* ARM_COMPUTE_ACL_HPP_ */ diff --git a/arm_compute/AclDescriptors.h b/arm_compute/AclDescriptors.h index 7b7655e9c7..a564bd2141 100644 --- a/arm_compute/AclDescriptors.h +++ b/arm_compute/AclDescriptors.h @@ -40,7 +40,7 @@ typedef enum AclLuBoundedRelu = 6, /**< Lower and Upper Bounded Rectifier */ AclLeakyRelu = 7, /**< Leaky Rectifier */ AclSoftRelu = 8, /**< Soft Rectifier */ - AclSoftElu = 9, /**< Exponential Linear Unit */ + AclElu = 9, /**< Exponential Linear Unit */ AclAbs = 10, /**< Absolute */ AclSquare = 11, /**< Square */ AclSqrt = 12, /**< Square root */ @@ -51,9 +51,10 @@ typedef enum /**< Activation layer descriptor */ typedef struct { - AclActivationType type; /**< Activation type */ - float a; /**< Factor &alpha used by some activations */ - float b; /**< Factor &beta used by some activations */ + AclActivationType type; /**< Activation type */ + float a; /**< Factor &alpha used by some activations */ + float b; /**< Factor &beta used by some activations */ + bool inplace; /**< Hint that src and dst tensors will be the same */ } AclActivationDescriptor; #ifdef __cplusplus } |