48 struct SoftmaxSelectorData
56 struct SoftmaxLogits1DKernel
63 struct SoftmaxLogits1DMaxKernel
67 SoftmaxLogits1DMaxKernelPtr
ukernel;
70 static const SoftmaxLogits1DKernel available_logits_1d_kernels[] =
72 #if defined(__ARM_FEATURE_SVE) 74 "sve_softmax_logits_1d_float",
75 [](
const SoftmaxSelectorData & data) {
return (data.dt ==
DataType::F32); },
79 "sve_softmax_logits_1d_float",
80 [](
const SoftmaxSelectorData & data) {
return (data.dt ==
DataType::F16); },
85 "neon_softmax_logits_1d_float",
86 [](
const SoftmaxSelectorData & data) {
return (data.dt ==
DataType::F32); },
89 #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) 91 "neon_softmax_logits_1d_float",
92 [](
const SoftmaxSelectorData & data) {
return (data.dt ==
DataType::F16); },
98 #if defined(__ARM_FEATURE_SVE2) 100 "sve_softmax_logits_1d_quantized",
105 "sve_softmax_logits_1d_quantized",
111 "neon_softmax_logits_1d_quantized",
116 "neon_softmax_logits_1d_quantized",
124 static const SoftmaxLogits1DMaxKernel available_logits_1d_max_kernels[] =
126 #if defined(__ARM_FEATURE_SVE) 129 [](
const SoftmaxSelectorData & data) {
return (data.dt ==
DataType::F32); },
134 [](
const SoftmaxSelectorData & data) {
return (data.dt ==
DataType::F16); },
149 "neon_logits_1d_max",
150 [](
const SoftmaxSelectorData & data) {
return (data.dt ==
DataType::F32); },
153 #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) 155 "neon_logits_1d_max",
156 [](
const SoftmaxSelectorData & data) {
return (data.dt ==
DataType::F16); },
161 "neon_logits_1d_max",
166 "neon_logits_1d_max",
173 const SoftmaxLogits1DKernel *get_implementation_logits(
const SoftmaxSelectorData &data)
175 for(
const auto &uk : available_logits_1d_kernels)
177 if(uk.is_selected({ data.dt }))
185 const SoftmaxLogits1DMaxKernel *get_implementation_logits_max(
const SoftmaxSelectorData &data)
187 for(
const auto &uk : available_logits_1d_max_kernels)
189 if(uk.is_selected({ data.dt }))
197 Status validate_arguments_logits_1d_max(
const ITensorInfo &
input,
const ITensorInfo &output)
203 if(output.total_size() != 0)
236 ICpuKernel::configure(win);
256 const auto *uk = get_implementation_logits_max(SoftmaxSelectorData{
src->info()->data_type() });
257 uk->ukernel(
src,
dst, window);
262 return "CpuLogits1DMaxKernel";
305 template <
bool IS_LOG>
311 template <
bool IS_LOG>
338 ICpuKernel::configure(win);
341 template <
bool IS_LOG>
351 template <
bool IS_LOG>
368 void *tmp_for_thread = tmp->buffer() + (info.
thread_id * tmp_size_for_thread);
370 const auto *uk = get_implementation_logits(SoftmaxSelectorData{
src->info()->data_type() });
371 uk->ukernel(
src, max, tmp_for_thread,
dst, _beta, IS_LOG, window);
374 template <
bool IS_LOG>
379 return "CpuLogits1DSoftmaxKernel";
383 return "CpuLogits1DLogSoftmaxKernel";
const char * name() const override
Name of the kernel.
virtual size_t num_dimensions() const =0
The number of dimensions of the tensor (rank)
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
SoftmaxLogits1DKernelPtr ukernel
static Status validate(const ITensorInfo *src, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration of CpuLogits1DMaxKernel.
const Window & window() const
The maximum window the kernel can be executed on.
void configure(const ITensorInfo *src, const ITensorInfo *max, ITensorInfo *dst, const float beta, ITensorInfo *tmp)
Set the input and output tensors.
#define ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(tensor)
#define REGISTER_FP16_NEON(func_name)
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(...)
CpuLogits1DMaxKernel()
Constructor.
#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
#define REGISTER_FP32_SVE(func_name)
ITensorInfo & set_data_type(DataType data_type) override
Set the data type to the specified value.
#define REGISTER_QASYMM8_SVE(func_name)
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
#define REGISTER_QASYMM8_SIGNED_NEON(func_name)
Store the tensor's metadata.
QuantizationInfo get_softmax_output_quantization_info(DataType input_type, bool is_log)
Returns output quantization information for softmax layer.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Interface for softmax computation for QASYMM8 with pre-computed max.
const char * name() const override
Name of the kernel.
virtual ITensorInfo & reset_padding()=0
Resets the padding settings of the tensor.
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
decltype(strategy::transforms) typedef type
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(...)
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
virtual void set_valid_region(const ValidRegion &valid_region)=0
Set the valid region of the tensor.
1 channel, 1 F16 per channel
ITensorInfo & set_quantization_info(const QuantizationInfo &quantization_info) override
Set the quantization settings (scale and offset) of the tensor.
#define REGISTER_QASYMM8_SIGNED_SVE(func_name)
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
Quantization information.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
#define REGISTER_QASYMM8_NEON(func_name)
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.
void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
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...
void configure(const ITensorInfo *src, ITensorInfo *dst)
Set the input and output tensors.
virtual QuantizationInfo quantization_info() const =0
Get the quantization settings (scale and offset) of the tensor.
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
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.
const SoftmaxSelectorPtr is_selected
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
#define REGISTER_FP16_SVE(func_name)
static Status validate(const ITensorInfo *src, const ITensorInfo *max, const ITensorInfo *dst, const float beta, const ITensorInfo *tmp)
Static function to check if given info will lead to a valid configuration of CpuLogits1DSoftmaxKernel...
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
CpuLogits1DSoftmaxKernel()
Default constructor.
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
unsigned int num_elems_processed_per_iteration
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Store the tensor's metadata.
void set_num_dimensions(size_t num_dimensions)
Set number of dimensions.
quantized, asymmetric fixed-point 8-bit number signed
Container for valid region of a window.
DataType
Available data types.
Describe a multidimensional execution window.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.