24.02.1
|
Go to the documentation of this file.
44 static const std::vector<CpuAddMulAddKernel::AddMulAddKernel> available_kernels = {
46 {
"neon_fp32_add_mul_add", [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::F32); },
48 {
"neon_fp16_add_mul_add", [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::F16); },
50 {
"neon_qasymm8_add_mul_add", [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::QASYMM8); },
52 {
"neon_qasymm8_signed_add_mul_add",
59 const ITensorInfo *input2,
60 const ITensorInfo *bn_mul,
61 const ITensorInfo *bn_add,
62 const ITensorInfo *add_output,
63 const ITensorInfo *final_output,
72 const ActFunction act_func =
act_info.activation();
74 act_func != ActFunction::LU_BOUNDED_RELU && act_func != ActFunction::IDENTITY),
75 "Only RELU Family activations, or no activation, is supported");
97 "First dimensions of inputs and batchNorm coefs should match");
100 if (add_output !=
nullptr && add_output->total_size() > 0)
107 if (final_output->total_size() > 0)
113 const auto uk = CpuAddMulAddKernel::get_implementation<DataTypeISASelectorData>(
114 DataTypeISASelectorData{input1->data_type(),
CPUInfo::get().get_isa()});
135 const auto uk = CpuAddMulAddKernel::get_implementation<DataTypeISASelectorData>(
142 _run_method = uk->ukernel;
143 _name = std::string(
"CpuAddMulAddKernel/").append(uk->name);
149 if (add_output !=
nullptr)
158 ICpuKernel::configure(win);
195 _run_method(input1, input2, bn_mul, bn_add, add_output, final_output, _policy, _act_info,
window);
200 return _name.c_str();
205 return available_kernels;
Class to describe a number of elements in each dimension.
void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
const char * name() const override
Name of the kernel.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
@ QASYMM8
quantized, asymmetric fixed-point 8-bit number unsigned
arm_compute::ActivationFunction ActivationFunction
void add_mul_add_fp16_neon(const ITensor *input1, const ITensor *input2, const ITensor *bn_mul, const ITensor *bn_add, ITensor *add_output, ITensor *final_output, ConvertPolicy policy, const ActivationLayerInfo &act_info, const Window &window)
bool set_data_type_if_unknown(ITensorInfo &info, DataType data_type)
Set the data type and number of channels to the specified value if the current data type is unknown.
Status validate_arguments(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const PadStrideInfo &conv_info)
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
#define REGISTER_QASYMM8_SIGNED_NEON(func_name)
static CPUInfo & get()
Access the KernelLibrary singleton.
Interface for CPU tensor.
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
#define REGISTER_FP16_NEON(func_name)
void add_mul_add_fp32_neon(const ITensor *input1, const ITensor *input2, const ITensor *bn_mul, const ITensor *bn_add, ITensor *add_output, ITensor *final_output, ConvertPolicy policy, const ActivationLayerInfo &act_info, const Window &window)
#define REGISTER_QASYMM8_NEON(func_name)
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Activation Layer Information class.
#define REGISTER_FP32_NEON(func_name)
static const std::vector< AddMulAddKernel > & get_available_kernels()
bool empty() const
Checks if pack is empty.
void configure(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *bn_mul, const ITensorInfo *bn_add, ITensorInfo *add_output, ITensorInfo *final_output, ConvertPolicy policy, const ActivationLayerInfo &act_info)
Initialize the kernel's inputs and outputs.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
#define ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(tensor)
@ QASYMM8_SIGNED
quantized, asymmetric fixed-point 8-bit number signed
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
virtual DataType data_type() const =0
Data type used for each element of the tensor.
void add_mul_add_s8_neon(const ITensor *input1, const ITensor *input2, const ITensor *bn_mul, const ITensor *bn_add, ITensor *add_output, ITensor *final_output, ConvertPolicy policy, const ActivationLayerInfo &act_info, const Window &window)
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
void add_mul_add_u8_neon(const ITensor *input1, const ITensor *input2, const ITensor *bn_mul, const ITensor *bn_add, ITensor *add_output, ITensor *final_output, ConvertPolicy policy, const ActivationLayerInfo &act_info, const Window &window)
const Window & window() const
The maximum window the kernel can be executed on.
Information about executing thread and CPU.
bool set_shape_if_empty(ITensorInfo &info, const TensorShape &shape)
Set the shape to the specified value if the current assignment is empty.
Describe a multidimensional execution window.
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
Copyright (c) 2017-2024 Arm Limited.
ConvertPolicy
Policy to handle integer overflow.
@ F16
16-bit floating-point number
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
bool is_data_type_quantized(DataType dt)
Check if a given data type is of quantized type.
Store the tensor's metadata.
@ F32
32-bit floating-point number
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *bn_mul, const ITensorInfo *bn_add, const ITensorInfo *add_output, const ITensorInfo *final_output, ConvertPolicy policy, const ActivationLayerInfo &act_info)
Static function to check if given info will lead to a valid configuration.