aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h
diff options
context:
space:
mode:
Diffstat (limited to 'arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h')
-rw-r--r--arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h361
1 files changed, 354 insertions, 7 deletions
diff --git a/arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h b/arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h
index de8b8f7843..e4268c1592 100644
--- a/arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h
+++ b/arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h
@@ -24,6 +24,7 @@
#ifndef ARM_COMPUTE_CLELEMENTWISEUNARYLAYER_H
#define ARM_COMPUTE_CLELEMENTWISEUNARYLAYER_H
+#include "arm_compute/runtime/CL/ICLOperator.h"
#include "arm_compute/runtime/CL/ICLSimpleFunction.h"
namespace arm_compute
@@ -31,9 +32,21 @@ namespace arm_compute
class ICLTensor;
/** Basic function to perform inverse square root on an input tensor. */
-class CLRsqrtLayer : public ICLSimpleFunction
+class CLRsqrtLayer : public IFunction
{
public:
+ /** Default Constructor */
+ CLRsqrtLayer();
+ /** Default Destructor */
+ ~CLRsqrtLayer();
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLRsqrtLayer(const CLRsqrtLayer &) = delete;
+ /** Default move constructor */
+ CLRsqrtLayer(CLRsqrtLayer &&);
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLRsqrtLayer &operator=(const CLRsqrtLayer &) = delete;
+ /** Default move assignment operator */
+ CLRsqrtLayer &operator=(CLRsqrtLayer &&);
/** Initialize the function
*
* @param[in] input Input tensor. Data types supported: F16/F32.
@@ -55,12 +68,31 @@ public:
* @return a status
*/
static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ void run() override;
+
+private:
+ struct Impl;
+ std::unique_ptr<Impl> _impl;
};
/** Basic function to perform exponential on an input tensor. */
-class CLExpLayer : public ICLSimpleFunction
+class CLExpLayer : public IFunction
{
public:
+ /** Default Constructor */
+ CLExpLayer();
+ /** Default Destructor */
+ ~CLExpLayer();
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLExpLayer(const CLExpLayer &) = delete;
+ /** Default move constructor */
+ CLExpLayer(CLExpLayer &&);
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLExpLayer &operator=(const CLExpLayer &) = delete;
+ /** Default move assignment operator */
+ CLExpLayer &operator=(CLExpLayer &&);
/** Initialize the function
*
* @param[in] input Input tensor. Data types supported: F16/F32.
@@ -82,12 +114,31 @@ public:
* @return a status
*/
static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ void run() override;
+
+private:
+ struct Impl;
+ std::unique_ptr<Impl> _impl;
};
/** Basic function to negate an input tensor. */
-class CLNegLayer : public ICLSimpleFunction
+class CLNegLayer : public IFunction
{
public:
+ /** Default Constructor */
+ CLNegLayer();
+ /** Default Destructor */
+ ~CLNegLayer();
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLNegLayer(const CLNegLayer &) = delete;
+ /** Default move constructor */
+ CLNegLayer(CLNegLayer &&);
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLNegLayer &operator=(const CLNegLayer &) = delete;
+ /** Default move assignment operator */
+ CLNegLayer &operator=(CLNegLayer &&);
/** Initialize the function
*
* @param[in] input Input tensor. Data types supported: F16/F32.
@@ -109,12 +160,31 @@ public:
* @return a status
*/
static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ void run() override;
+
+private:
+ struct Impl;
+ std::unique_ptr<Impl> _impl;
};
/** Basic function to calculate sine of an input tensor. */
-class CLSinLayer : public ICLSimpleFunction
+class CLSinLayer : public IFunction
{
public:
+ /** Default Constructor */
+ CLSinLayer();
+ /** Default Destructor */
+ ~CLSinLayer();
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLSinLayer(const CLSinLayer &) = delete;
+ /** Default move constructor */
+ CLSinLayer(CLSinLayer &&);
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLSinLayer &operator=(const CLSinLayer &) = delete;
+ /** Default move assignment operator */
+ CLSinLayer &operator=(CLSinLayer &&);
/** Initialize the function
*
* @param[in] input Input tensor. Data types supported: F16/F32.
@@ -136,12 +206,31 @@ public:
* @return a status
*/
static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ void run() override;
+
+private:
+ struct Impl;
+ std::unique_ptr<Impl> _impl;
};
/** Basic function to perform elementwise log on an input tensor. */
-class CLLogLayer : public ICLSimpleFunction
+class CLLogLayer : public IFunction
{
public:
+ /** Default Constructor */
+ CLLogLayer();
+ /** Default Destructor */
+ ~CLLogLayer();
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLLogLayer(const CLLogLayer &) = delete;
+ /** Default move constructor */
+ CLLogLayer(CLLogLayer &&);
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLLogLayer &operator=(const CLLogLayer &) = delete;
+ /** Default move assignment operator */
+ CLLogLayer &operator=(CLLogLayer &&);
/** Initialize the function
*
* @param[in] input Input tensor. Data types supported: F16/F32.
@@ -163,12 +252,31 @@ public:
* @return a status
*/
static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ void run() override;
+
+private:
+ struct Impl;
+ std::unique_ptr<Impl> _impl;
};
/** Basic function to get the absolute value of an input tensor. */
-class CLAbsLayer : public ICLSimpleFunction
+class CLAbsLayer : public IFunction
{
public:
+ /** Default Constructor */
+ CLAbsLayer();
+ /** Default Destructor */
+ ~CLAbsLayer();
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLAbsLayer(const CLAbsLayer &) = delete;
+ /** Default move constructor */
+ CLAbsLayer(CLAbsLayer &&);
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLAbsLayer &operator=(const CLAbsLayer &) = delete;
+ /** Default move assignment operator */
+ CLAbsLayer &operator=(CLAbsLayer &&);
/** Initialize the function
*
* @param[in] input Input tensor. Data types supported: F16/F32.
@@ -190,12 +298,31 @@ public:
* @return a status
*/
static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ void run() override;
+
+private:
+ struct Impl;
+ std::unique_ptr<Impl> _impl;
};
/** Basic function to get the round (to the nearest even) value of an input tensor. */
-class CLRoundLayer : public ICLSimpleFunction
+class CLRoundLayer : public IFunction
{
public:
+ /** Default Constructor */
+ CLRoundLayer();
+ /** Default Destructor */
+ ~CLRoundLayer();
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLRoundLayer(const CLRoundLayer &) = delete;
+ /** Default move constructor */
+ CLRoundLayer(CLRoundLayer &&);
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ CLRoundLayer &operator=(const CLRoundLayer &) = delete;
+ /** Default move assignment operator */
+ CLRoundLayer &operator=(CLRoundLayer &&);
/** Initialize the function
*
* @param[in] input Input tensor. Data types supported: F16/F32.
@@ -217,6 +344,226 @@ public:
* @return a status
*/
static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ void run() override;
+
+private:
+ struct Impl;
+ std::unique_ptr<Impl> _impl;
+};
+
+namespace experimental
+{
+/** Basic function to perform inverse square root on an input tensor. */
+class CLRsqrtLayer : public ICLOperator
+{
+public:
+ /** Initialize the function
+ *
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const ITensorInfo *input, ITensorInfo *output);
+ /** Initialize the function
+ *
+ * @param[in] compile_context The compile context to be used.
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output);
+ /** Static function to check if given info will lead to a valid configuration of @ref CLRsqrtLayer
+ *
+ * @param[in] input First tensor input info. Data types supported: F16/F32.
+ * @param[in] output Output tensor info. Data types supported: Same as @p input.
+ *
+ * @return a status
+ */
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ MemoryRequirements workspace() const override;
+};
+
+/** Basic function to perform exponential on an input tensor. */
+class CLExpLayer : public ICLOperator
+{
+public:
+ /** Initialize the function
+ *
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const ITensorInfo *input, ITensorInfo *output);
+ /** Initialize the function
+ *
+ * @param[in] compile_context The compile context to be used.
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output);
+ /** Static function to check if given info will lead to a valid configuration of @ref CLExpLayer
+ *
+ * @param[in] input First tensor input info. Data types supported: F16/F32.
+ * @param[in] output Output tensor info. Data types supported: Same as @p input.
+ *
+ * @return a status
+ */
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ MemoryRequirements workspace() const override;
+};
+
+/** Basic function to negate an input tensor. */
+class CLNegLayer : public ICLOperator
+{
+public:
+ /** Initialize the function
+ *
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const ITensorInfo *input, ITensorInfo *output);
+ /** Initialize the function
+ *
+ * @param[in] compile_context The compile context to be used.
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output);
+ /** Static function to check if given info will lead to a valid configuration of @ref CLNegLayer
+ *
+ * @param[in] input First tensor input info. Data types supported: F16/F32.
+ * @param[in] output Output tensor info. Data types supported: Same as @p input.
+ *
+ * @return a status
+ */
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ MemoryRequirements workspace() const override;
+};
+
+/** Basic function to calculate sine of an input tensor. */
+class CLSinLayer : public ICLOperator
+{
+public:
+ /** Initialize the function
+ *
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const ITensorInfo *input, ITensorInfo *output);
+ /** Initialize the function
+ *
+ * @param[in] compile_context The compile context to be used.
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output);
+ /** Static function to check if given info will lead to a valid configuration of @ref CLSinLayer
+ *
+ * @param[in] input First tensor input info. Data types supported: F16/F32.
+ * @param[in] output Output tensor info. Data types supported: Same as @p input.
+ *
+ * @return a status
+ */
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ MemoryRequirements workspace() const override;
+};
+
+/** Basic function to perform elementwise log on an input tensor. */
+class CLLogLayer : public ICLOperator
+{
+public:
+ /** Initialize the function
+ *
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const ITensorInfo *input, ITensorInfo *output);
+ /** Initialize the function
+ *
+ * @param[in] compile_context The compile context to be used.
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output);
+ /** Static function to check if given info will lead to a valid configuration of @ref CLLogLayer
+ *
+ * @param[in] input First tensor input info. Data types supported: F16/F32.
+ * @param[in] output Output tensor info. Data types supported: Same as @p input.
+ *
+ * @return a status
+ */
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ MemoryRequirements workspace() const override;
+};
+
+/** Basic function to get the absolute value of an input tensor. */
+class CLAbsLayer : public ICLOperator
+{
+public:
+ /** Initialize the function
+ *
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const ITensorInfo *input, ITensorInfo *output);
+ /** Initialize the function
+ *
+ * @param[in] compile_context The compile context to be used.
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output);
+ /** Static function to check if given info will lead to a valid configuration of @ref CLAbsLayer
+ *
+ * @param[in] input First tensor input info. Data types supported: F16/F32.
+ * @param[in] output Output tensor info. Data types supported: Same as @p input.
+ *
+ * @return a status
+ */
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ MemoryRequirements workspace() const override;
+};
+
+/** Basic function to get the round (to the nearest even) value of an input tensor. */
+class CLRoundLayer : public ICLOperator
+{
+public:
+ /** Initialize the function
+ *
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const ITensorInfo *input, ITensorInfo *output);
+ /** Initialize the function
+ *
+ * @param[in] compile_context The compile context to be used.
+ * @param[in] input Input tensor info. Data types supported: F16/F32.
+ * @param[out] output Output tensor info. Data types supported: same as @p input.
+ */
+ void configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output);
+ /** Static function to check if given info will lead to a valid configuration of @ref CLRoundLayer
+ *
+ * @param[in] input First tensor input info. Data types supported: F16/F32.
+ * @param[in] output Output tensor info. Data types supported: Same as @p input.
+ *
+ * @return a status
+ */
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+
+ // Inherited methods overridden:
+ MemoryRequirements workspace() const override;
};
+} // namespace experimental
} // namespace arm_compute
#endif /* ARM_COMPUTE_CLELEMENTWISEUNARYLAYER_H */