42 struct SubSelectorData
49 using SubSelectorPtr = std::add_pointer<bool(
const SubSelectorData &data)>
::type;
50 using SubKernelPtr = std::add_pointer<void(
const ITensor *,
const ITensor *, ITensor *,
const ConvertPolicy &,
const Window &)>
::type;
59 static const SubKernel available_kernels[] =
63 [](
const SubSelectorData & data) {
return ((data.dt1 == data.dt2) && (data.dt1 ==
DataType::F32)); },
66 #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) 69 [](
const SubSelectorData & data) {
return ((data.dt1 == data.dt2) && (data.dt1 ==
DataType::F16)); },
75 [](
const SubSelectorData & data) {
return ((data.dt1 == data.dt2) && (data.dt1 == data.dt3) && (data.dt1 ==
DataType::U8)); },
80 [](
const SubSelectorData & data) {
return ((data.dt1 == data.dt2) && (data.dt1 == data.dt3) && (data.dt1 ==
DataType::S16)); },
85 [](
const SubSelectorData & data) {
return ((data.dt1 == data.dt2) && (data.dt1 == data.dt3) && (data.dt1 ==
DataType::S32)); },
89 "sub_u8_s16_s16_neon",
94 "sub_s16_u8_s16_neon",
100 [](
const SubSelectorData & data) {
return ((data.dt1 == data.dt2) && (data.dt3 ==
DataType::S16)); },
105 [](
const SubSelectorData & data) {
return ((data.dt1 == data.dt2) && (data.dt1 ==
DataType::QASYMM8)); },
109 "sub_qasymm8_signed_neon",
115 [](
const SubSelectorData & data) {
return ((data.dt1 == data.dt2) && (data.dt1 ==
DataType::QSYMM16)); },
128 for(
const auto &uk : available_kernels)
130 if(uk.is_selected({ dt1, dt2, dt3 }))
149 const auto *uk = get_implementation(src0.data_type(), src1.data_type(),
dst.data_type());
167 "You called subtract with the wrong image formats");
173 "Convert policy cannot be WRAP if datatype is quantized");
176 if(
dst.total_size() > 0)
190 "You called subtract with the wrong image formats");
193 "Wrong shape for dst");
214 ICpuKernel::configure(win);
237 uk->ukernel(src0, src1,
dst, _policy,
window);
242 return "CpuSubKernel";
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
const Window & window() const
The maximum window the kernel can be executed on.
const SubSelectorPtr is_selected
quantized, symmetric fixed-point 16-bit number
#define ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(tensor)
#define REGISTER_FP16_NEON(func_name)
1 channel, 1 U8 per channel
#define REGISTER_FP32_NEON(func_name)
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
1 channel, 1 F32 per channel
static TensorShape broadcast_shape(const Shapes &... shapes)
If shapes are broadcast compatible, return the broadcasted shape.
#define REGISTER_QASYMM8_SIGNED_NEON(func_name)
Store the tensor's metadata.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
static Status validate(const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *dst, ConvertPolicy policy)
Static function to check if given info will lead to a valid configuration of CpuSubKernel.
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
decltype(strategy::transforms) typedef type
Interface for CPU tensor.
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
#define REGISTER_INTEGER_NEON(func_name)
const char * name() const override
Name of the kernel.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
1 channel, 1 S32 per channel
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
#define REGISTER_QASYMM8_NEON(func_name)
void configure(const ITensorInfo *src0, const ITensorInfo *src1, ITensorInfo *dst, ConvertPolicy policy)
Initialise the kernel's src and dst.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
quantized, asymmetric fixed-point 8-bit number unsigned
Class to describe a number of elements in each dimension.
#define REGISTER_QSYMM16_NEON(func_name)
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
bool set_shape_if_empty(ITensorInfo &info, const TensorShape &shape)
Set the shape to the specified value if the current assignment is empty.
bool have_different_dimensions(const Dimensions< T > &dim1, const Dimensions< T > &dim2, unsigned int upper_dim)
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
1 channel, 1 S16 per channel
void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
void sub_qasymm8_signed_neon(const ITensor *src0, const ITensor *src1, ITensor *dst, const ConvertPolicy &policy, const Window &window)
void sub_u8_u8_s16_neon(const ITensor *src0, const ITensor *src1, ITensor *dst, const ConvertPolicy &policy, const Window &window)
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.
void sub_qsymm16_neon(const ITensor *src0, const ITensor *src1, ITensor *dst, const ConvertPolicy &policy, const Window &window)
Information about executing thread and CPU.
void sub_qasymm8_neon(const ITensor *src0, const ITensor *src1, ITensor *dst, const ConvertPolicy &policy, const Window &window)
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const GEMMLowpOutputStageInfo *output_stage)
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
void sub_u8_s16_s16_neon(const ITensor *src0, const ITensor *src1, ITensor *dst, const ConvertPolicy &policy, const Window &window)
quantized, asymmetric fixed-point 8-bit number signed
void sub_s16_u8_s16_neon(const ITensor *src0, const ITensor *src1, ITensor *dst, const ConvertPolicy &policy, const Window &window)
DataType
Available data types.
Describe a multidimensional execution window.
ConvertPolicy
Policy to handle overflow.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)