Compute Library
 22.08
CpuElementwiseUnary Class Reference

#include <CpuElementwiseUnary.h>

Collaboration diagram for CpuElementwiseUnary:
[legend]

Public Member Functions

void configure (ElementWiseUnary op, const ITensorInfo &src, ITensorInfo &dst)
 Initialize the function. 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 (ElementWiseUnary op, const ITensorInfo &src, const ITensorInfo &dst)
 Static function to check if given info will lead to a valid configuration. More...
 

Detailed Description

Definition at line 34 of file CpuElementwiseUnary.h.

Member Function Documentation

◆ configure()

void configure ( ElementWiseUnary  op,
const ITensorInfo src,
ITensorInfo dst 
)

Initialize the function.

Parameters
[in]opUnary operation to execute
[in]srcInput tensor information. Data types supported: F16/F32, F16/F32/S32 for NEG/ABS operations.
[out]dstOutput tensor information. Data types supported: Same as src.

Definition at line 35 of file CpuElementwiseUnary.cpp.

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

36 {
38  auto k = std::make_unique<KernelType>();
39  k->configure(op, src, dst);
40  _kernel = std::move(k);
41 }
SimpleTensor< float > src
Definition: DFT.cpp:155
#define ARM_COMPUTE_LOG_PARAMS(...)

◆ 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 48 of file CpuElementwiseUnary.cpp.

References arm_compute::ACL_SRC, ITensorPack::get_const_tensor(), ITensor::info(), INEOperator::run(), arm_compute::test::validation::src_info, and TensorInfo::tensor_shape().

49 {
50  if(_kernel->is_window_configured())
51  {
52  ICpuOperator::run(tensors);
53  return;
54  }
55 
56  auto src_info = tensors.get_const_tensor(TensorType::ACL_SRC)->info();
57  ICpuOperator::run(tensors, compute_output_shape_and_window(src_info->tensor_shape()).second);
58 }
void run(ITensorPack &tensors) override
Run the kernels contained in the function.
Definition: INEOperator.cpp:40
TensorInfo src_info(src_shape, 1, data_type)
const TensorShape & tensor_shape() const override
Size for each dimension of the tensor.
Definition: TensorInfo.h:234

◆ validate()

Status validate ( ElementWiseUnary  op,
const ITensorInfo src,
const ITensorInfo dst 
)
static

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

Similar to CpuElementwiseUnary::configure()

Returns
a status

Definition at line 43 of file CpuElementwiseUnary.cpp.

References CpuElementwiseUnaryKernel::validate().

44 {
45  return KernelType::validate(op, src, dst);
46 }
SimpleTensor< float > src
Definition: DFT.cpp:155
static Status validate(ElementWiseUnary op, const ITensorInfo &src, const ITensorInfo &dst)
Static function to check if given info will lead to a valid configuration.

The documentation for this class was generated from the following files: