24.02.1
|
Go to the documentation of this file.
52 static const std::vector<typename CpuSoftmaxKernel::SoftmaxKernel> available_kernels = {
54 [](
const SoftmaxKernelDataTypeISASelectorData &data) {
return (!data.is_log && data.dt ==
DataType::F32); },
57 [](
const SoftmaxKernelDataTypeISASelectorData &data)
58 {
return (!data.is_log && data.dt ==
DataType::F16) && data.isa.fp16; },
61 [](
const SoftmaxKernelDataTypeISASelectorData &data) {
return (!data.is_log && data.dt ==
DataType::QASYMM8); },
64 [](
const SoftmaxKernelDataTypeISASelectorData &data)
67 {
"neon_fp32_log_softmax",
68 [](
const SoftmaxKernelDataTypeISASelectorData &data) {
return (data.is_log && data.dt ==
DataType::F32); },
70 {
"neon_fp16_log_softmax",
71 [](
const SoftmaxKernelDataTypeISASelectorData &data)
72 {
return (data.is_log && data.dt ==
DataType::F16) && data.isa.fp16; },
74 {
"neon_qu8_log_softmax",
75 [](
const SoftmaxKernelDataTypeISASelectorData &data) {
return (data.is_log && data.dt ==
DataType::QASYMM8); },
77 {
"neon_qs8_log_softmax",
78 [](
const SoftmaxKernelDataTypeISASelectorData &data)
83 Status validate_arguments_softmax(
84 const ITensorInfo &
src,
const ITensorInfo &
dst,
float beta,
const ITensorInfo &tmp,
bool is_log)
95 if (
dst.total_size() != 0)
97 const QuantizationInfo output_quantization =
99 :
dst.quantization_info();
106 if (tmp.total_size() != 0)
124 return available_kernels;
138 :
dst->quantization_info();
142 if (is_quantized_asymmetric)
151 std::string
kernel_name = is_log ? std::string(
"CpuLogSoftmaxKernel") : std::string(
"CpuSoftmaxKernel");
154 _run_method = uk->ukernel;
198 void *tmp_for_thread = tmp->buffer() + (
info.thread_id * tmp_size_for_thread);
209 return _name.c_str();
Class to describe a number of elements in each dimension.
SimpleTensor< float > src
Quantization information.
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
const char * name() const override
Name of the kernel.
static Status validate(const ITensorInfo *src, const ITensorInfo *dst, float beta, bool is_log, const ITensorInfo *tmp)
Static function to check if given info will lead to a valid configuration.
@ QASYMM8
quantized, asymmetric fixed-point 8-bit number unsigned
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
template void neon_fp32_softmax< false >(const ITensor *in, void *const tmp, ITensor *out, const float beta, const Window &window)
#define REGISTER_QASYMM8_SIGNED_NEON(func_name)
static CPUInfo & get()
Access the KernelLibrary singleton.
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
#define REGISTER_FP16_NEON(func_name)
ITensorInfo & set_data_type(DataType data_type) override
Set the data type to the specified value.
#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,...)
template void neon_qasymm8_softmax< false >(const ITensor *in, void *const tmp, ITensor *out, const float beta, const Window &window)
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
template void neon_qasymm8_signed_softmax< true >(const ITensor *in, void *const tmp, ITensor *out, const float beta, const Window &window)
#define REGISTER_FP32_NEON(func_name)
#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.
QuantizationInfo get_softmax_output_quantization_info(DataType input_type, bool is_log)
Returns output quantization information for softmax layer.
ITensorInfo & set_quantization_info(const QuantizationInfo &quantization_info) override
Set the quantization settings (scale and offset) of the tensor.
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
virtual ITensorInfo & reset_padding()=0
Resets the padding settings of the tensor.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Window collapse(const Window &full_window, size_t first, size_t last=Coordinates::num_max_dimensions) const
Collapse the dimensions between first and last.
#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)
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, float beta, bool is_log, ITensorInfo *tmp)
Set the input and output tensors.
@ QASYMM8_SIGNED
quantized, asymmetric fixed-point 8-bit number signed
#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.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Describe one of the image's dimensions with a start, end and step.
static const auto * get_implementation(const SelectorType &selector, KernelSelectionType selection_type=KernelSelectionType::Supported)
Micro-kernel selector.
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
const Window & window() const
The maximum window the kernel can be executed on.
Information about executing thread and CPU.
Store the tensor's metadata.
static const std::vector< SoftmaxKernel > & get_available_kernels()
Describe a multidimensional execution window.
template void neon_qasymm8_signed_softmax< false >(const ITensor *in, void *const tmp, ITensor *out, const float beta, const Window &window)
Copyright (c) 2017-2024 Arm Limited.
@ F16
16-bit floating-point number
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
template void neon_fp32_softmax< true >(const ITensor *in, void *const tmp, ITensor *out, const float beta, const Window &window)
Store the tensor's metadata.
@ F32
32-bit floating-point number
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
bool has_holes(const ITensorInfo &info)
Check if the tensor has any holes.
unsigned int num_elems_processed_per_iteration
template void neon_qasymm8_softmax< true >(const ITensor *in, void *const tmp, ITensor *out, const float beta, const Window &window)