46 using ElementwiseUnarySelector = std::add_pointer<bool(
DataType)>
::type;
48 struct ElementwiseUnaryKernel
55 static const ElementwiseUnaryKernel available_kernels[] =
57 #if defined(__ARM_FEATURE_SVE) 59 "fp32_sve_elementwise_unary",
64 "fp16_sve_elementwise_unary",
69 "s32_sve_elementwise_unary",
73 #endif // defined(__ARM_FEATURE_SVE) 75 "fp32_neon_elementwise_unary",
79 #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) 81 "fp16_neon_elementwise_unary",
85 #endif // defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) 87 "s32_neon_elementwise_unary",
93 const ElementwiseUnaryKernel *get_implementation(
DataType dt)
95 for(
const auto &uk : available_kernels)
97 if(uk.is_selected(
dt))
123 auto shape_and_window = compute_output_shape_and_window(
src.tensor_shape());
125 ICpuKernel::configure(shape_and_window.second);
132 const auto *uk = get_implementation(
src.data_type());
152 if(
dst.total_size() > 0)
166 auto func = get_implementation(
src->info()->data_type())->
ukernel;
const ElementwiseUnarySelector is_selected
CpuElementwiseUnaryKernel()
Default constructor.
const Window & window() const
The maximum window the kernel can be executed on.
#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)
CpuElementwiseUnaryKernel::ElementwiseUnaryUkernelPtr ukernel
1 channel, 1 F32 per channel
#define REGISTER_FP32_SVE(func_name)
#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)
#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.
#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.
#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 of CpuElementwiseUnaryKerne...
#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.