Compute Library
 23.11
CpuActivation Class Reference

Basic function to run kernels::CpuActivationKernel. More...

#include <CpuActivation.h>

Collaboration diagram for CpuActivation:
[legend]

Public Member Functions

void configure (const ITensorInfo *input, ITensorInfo *output, const ActivationLayerInfo &activation_info)
 Configure operator for a given list of arguments. More...
 
void run (ITensorPack &tensors) override
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from INEOperator
 INEOperator (IRuntimeContext *ctx=nullptr)
 Constructor. More...
 
 INEOperator (const INEOperator &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 INEOperator (INEOperator &&)=default
 Default move constructor. More...
 
INEOperatoroperator= (const INEOperator &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
INEOperatoroperator= (INEOperator &&)=default
 Default move assignment operator. More...
 
 ~INEOperator ()
 Default destructor. More...
 
void prepare (ITensorPack &constants) override
 Prepare the function for executing. More...
 
MemoryRequirements workspace () const override
 Return the memory requirements required by the workspace. More...
 
- Public Member Functions inherited from IOperator
virtual ~IOperator ()=default
 Destructor. More...
 

Static Public Member Functions

static Status validate (const ITensorInfo *input, const ITensorInfo *output, const ActivationLayerInfo &act_info)
 Static function to check if given info will lead to a valid configuration. More...
 

Detailed Description

Basic function to run kernels::CpuActivationKernel.

Definition at line 36 of file CpuActivation.h.

Member Function Documentation

◆ configure()

void configure ( const ITensorInfo input,
ITensorInfo output,
const ActivationLayerInfo activation_info 
)

Configure operator for a given list of arguments.

Parameters
[in]inputSource tensor info. Data types supported: QASYMM8/QASYMM8_SIGNED/QSYMM16/F16/F32.
[out]outputDestination tensor info. Data type supported: same as src
[in]activation_infoActivation layer parameters.

Definition at line 38 of file CpuActivation.cpp.

39 {
40  ARM_COMPUTE_LOG_PARAMS(input, output, activation_info);
41  auto k = std::make_unique<kernels::CpuActivationKernel>();
42  k->configure(input, output, activation_info);
43  _kernel = std::move(k);
44 }

References ARM_COMPUTE_LOG_PARAMS, and arm_compute::test::validation::input.

◆ run()

void run ( ITensorPack tensors)
overridevirtual

Run the kernels contained in the function.

Parameters
[in]tensorsVector that contains the tensors to operate on.

Reimplemented from INEOperator.

Definition at line 52 of file CpuActivation.cpp.

53 {
54  ARM_COMPUTE_ERROR_ON_MSG(tensors.empty(), "No inputs provided");
55  auto split_dimension = static_cast<kernels::CpuActivationKernel *>(_kernel.get())->get_split_dimension_hint();
56  NEScheduler::get().schedule_op(_kernel.get(), split_dimension, _kernel->window(), tensors);
57 }

References ARM_COMPUTE_ERROR_ON_MSG, ITensorPack::empty(), Scheduler::get(), and IScheduler::schedule_op().

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
const ActivationLayerInfo act_info 
)
static

Static function to check if given info will lead to a valid configuration.

Similar to CpuActivation::configure()

Returns
a status

Definition at line 47 of file CpuActivation.cpp.

48 {
49  return kernels::CpuActivationKernel::validate(input, output, activation_info);
50 }

References arm_compute::test::validation::input, and CpuActivationKernel::validate().

Referenced by CpuContext::create_activation(), CpuDirectConv3d::validate(), CpuDirectConv2d::validate(), NEActivationLayer::validate(), CpuGemm::validate(), and CpuGemmLowpMatrixMultiplyCore::validate().


The documentation for this class was generated from the following files:
arm_compute::IScheduler::schedule_op
virtual void schedule_op(ICPPKernel *kernel, const Hints &hints, const Window &window, ITensorPack &tensors)=0
Runs the kernel in the same thread as the caller synchronously.
ARM_COMPUTE_ERROR_ON_MSG
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456
arm_compute::cpu::kernels::CpuActivationKernel::validate
static Status validate(const ITensorInfo *src, const ITensorInfo *dst, const ActivationLayerInfo &act_info)
Static function to check if given info will lead to a valid configuration.
Definition: CpuActivationKernel.cpp:300
arm_compute::Scheduler::get
static IScheduler & get()
Access the scheduler singleton.
Definition: Scheduler.cpp:94
ARM_COMPUTE_LOG_PARAMS
#define ARM_COMPUTE_LOG_PARAMS(...)
Definition: Log.h:35
arm_compute::test::validation::input
auto input
Definition: LSTMLayerQuantized.cpp:486