46 struct ElementwiseUnarySelectorData
53 struct ElementwiseUnaryKernel
60 static const ElementwiseUnaryKernel available_kernels[] =
62 #if defined(ARM_COMPUTE_ENABLE_SVE) 64 "sve_fp32_elementwise_unary",
65 [](
const ElementwiseUnarySelectorData & data) {
return data.dt ==
DataType::F32; },
69 "sve_fp16_elementwise_unary",
70 [](
const ElementwiseUnarySelectorData & data) {
return data.dt ==
DataType::F16; },
74 "sve_s32_elementwise_unary",
75 [](
const ElementwiseUnarySelectorData & data) {
return data.dt ==
DataType::S32; },
78 #endif // defined(ARM_COMPUTE_ENABLE_SVE) 79 #if defined(ARM_COMPUTE_ENABLE_NEON) 81 "neon_fp32_elementwise_unary",
82 [](
const ElementwiseUnarySelectorData & data) {
return data.dt ==
DataType::F32; },
85 #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) 87 "neon_fp16_elementwise_unary",
88 [](
const ElementwiseUnarySelectorData & data) {
return data.dt ==
DataType::F16; },
91 #endif // defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) 93 "neon_s32_elementwise_unary",
94 [](
const ElementwiseUnarySelectorData & data) {
return data.dt ==
DataType::S32; },
97 #endif // defined(ARM_COMPUTE_ENABLE_NEON) 100 const ElementwiseUnaryKernel *get_implementation(
DataType dt)
102 for(
const auto &uk : available_kernels)
104 if(uk.is_selected({ dt, CPUInfo::get() }))
116 const auto uk = get_implementation(src.
data_type());
120 _run_method = uk->ukernel;
121 _name = std::string(
"CpuElementwiseUnaryKernel").append(
"/").append(uk->name);
129 auto shape_and_window = compute_output_shape_and_window(src.
tensor_shape());
131 ICpuKernel::configure(shape_and_window.second);
138 const auto *uk = get_implementation(src.
data_type());
173 _run_method(
src,
dst, window, _op);
178 return _name.c_str();
const ElementwiseUnarySelector is_selected
#define ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(tensor)
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
#define REGISTER_FP32_NEON(func_name)
virtual DataType data_type() const =0
Data type used for each element of the tensor.
CpuElementwiseUnaryKernel::ElementwiseUnaryUkernelPtr ukernel
1 channel, 1 F32 per channel
#define REGISTER_FP32_SVE(func_name)
const char * name() const override
Name of the kernel.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Store the tensor's metadata.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
virtual bool is_dynamic() const =0
Flag indicating whether the shape of the tensor is dynamic, meaning that it can change on kernel/func...
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
decltype(strategy::transforms) typedef type
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
#define REGISTER_INTEGER_NEON(func_name)
1 channel, 1 S32 per channel
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
#define REGISTER_INTEGER_SVE(func_name)
bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, QuantizationInfo quantization_info=QuantizationInfo())
Auto initialize the tensor info (shape, number of channels and data type) if the current assignment i...
std::add_pointer< void(const ITensor *, ITensor *, const Window &, ElementWiseUnary)>::type ElementwiseUnaryUkernelPtr
Common signature for all the specialised elementwise unary micro-kernels.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
Information about executing thread and CPU.
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
#define REGISTER_FP16_SVE(func_name)
static Status validate(ElementWiseUnary op, const ITensorInfo &src, const ITensorInfo &dst)
Static function to check if given info will lead to a valid configuration.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
void configure(ElementWiseUnary op, const ITensorInfo &src, ITensorInfo &dst)
Function to configure the CpuElementwiseUnaryKernel.
DataType
Available data types.
ElementWiseUnary
Available element wise unary operations.
Describe a multidimensional execution window.
Status validate(const ITensorInfo *scores_in, const ITensorInfo *boxes_in, const ITensorInfo *batch_splits_in, const ITensorInfo *scores_out, const ITensorInfo *boxes_out, const ITensorInfo *classes, const ITensorInfo *batch_splits_out, const ITensorInfo *keeps, const ITensorInfo *keeps_size, const BoxNMSLimitInfo info)