23.11
|
Go to the documentation of this file.
49 static const std::vector<CpuLogits1DMaxKernel::SoftmaxLogits1DMaxKernel> available_kernels_max_logits = {
50 {
"sve_fp32_logits_1d_max",
51 [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::F32) && data.isa.sve; },
53 {
"sve_fp16_logits_1d_max",
54 [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::F16) && data.isa.sve && data.isa.fp16; },
56 {
"sve_qu8_logits_1d_max",
57 [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::QASYMM8) && data.isa.sve; },
59 {
"sve_qs8_logits_1d_max",
62 {
"neon_fp32_logits_1d_max", [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::F32); },
64 {
"neon_fp16_logits_1d_max",
65 [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::F16) && data.isa.fp16; },
67 {
"neon_qu8_logits_1d_max", [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::QASYMM8); },
69 {
"neon_qs8_logits_1d_max",
74 Status validate_arguments_logits_1d_max(
const ITensorInfo &
input,
const ITensorInfo &output)
81 if (output.total_size() != 0)
86 TensorShape(
input.tensor_shape()).set(0, 1));
94 return available_kernels_max_logits;
110 _run_method = uk->ukernel;
111 _name = std::string(
"CpuLogits1DMaxKernel").append(
"/").append(uk->name);
114 ICpuKernel::configure(win);
140 return _name.c_str();
144 template <
bool IS_LOG>
145 static const std::vector<typename CpuLogits1DSoftmaxKernel<IS_LOG>::SoftmaxLogits1DKernel> available_kernels_logits = {
146 {
"sve2_qu8_softmax_logits_1d",
149 {
"sve2_qs8_softmax_logits_1d",
152 {
"sve_fp32_softmax_logits_1d",
153 [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::F32) && data.isa.sve; },
155 {
"sve_fp16_softmax_logits_1d",
156 [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::F16) && data.isa.sve && data.isa.fp16; },
159 {
"neon_fp32_softmax_logits_1d", [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::F32); },
161 {
"neon_fp16_softmax_logits_1d",
162 [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::F16) && data.isa.fp16; },
164 {
"neon_qu8_softmax_logits_1d", [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::QASYMM8); },
166 {
"neon_qs8_softmax_logits_1d",
172 Status validate_arguments_logits_softmax(
const ITensorInfo &
src,
173 const ITensorInfo &max,
174 const ITensorInfo &
dst,
176 const ITensorInfo &tmp,
193 if (
dst.total_size() != 0)
195 const QuantizationInfo output_quantization =
197 :
dst.quantization_info();
204 if (tmp.total_size() != 0)
217 template <
bool IS_LOG>
218 const std::vector<typename CpuLogits1DSoftmaxKernel<IS_LOG>::SoftmaxLogits1DKernel> &
221 return available_kernels_logits<IS_LOG>;
224 template <
bool IS_LOG>
237 :
dst->quantization_info();
249 IS_LOG ? std::string(
"CpuLogits1DLogSoftmaxKernel") : std::string(
"CpuLogits1DSoftmaxKernel");
252 _run_method = uk->ukernel;
261 template <
bool IS_LOG>
271 template <
bool IS_LOG>
289 void *tmp_for_thread = tmp->buffer() + (
info.thread_id * tmp_size_for_thread);
290 _run_method(
src, max, tmp_for_thread,
dst, _beta, IS_LOG, window);
293 template <
bool IS_LOG>
296 return _name.c_str();
Class to describe a number of elements in each dimension.
im2col_func configure(src_target.info(), dst_target.info(), spatial_kernel, conv_info, has_bias)
void sve_fp16_softmax(const ITensor *in, const ITensor *max, void *const tmp, ITensor *out, const float beta, bool is_log, const Window &window)
SimpleTensor< float > src
void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
Quantization information.
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
Interface for softmax computation for QASYMM8 with pre-computed max.
@ QASYMM8
quantized, asymmetric fixed-point 8-bit number unsigned
static Status validate(const ITensorInfo *src, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration.
#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.
void sve2_qasymm8_signed_softmax(const ITensor *in, const ITensor *max, void *const tmp, ITensor *out, const float beta, bool is_log, const Window &window)
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.
void sve_fp16_logits(const ITensor *in, ITensor *out, const Window &window)
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.
#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.
#define REGISTER_FP32_NEON(func_name)
void neon_qasymm8_signed_softmax(const ITensor *in, const ITensor *max, void *const tmp, ITensor *out, const float beta, bool is_log, const Window &window)
#define REGISTER_QASYMM8_SVE(func_name)
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
#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.
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.
void sve_fp32_softmax(const ITensor *in, const ITensor *max, void *const tmp, ITensor *out, const float beta, bool is_log, const Window &window)
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)
#define REGISTER_QASYMM8_SIGNED_SVE(func_name)
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
void neon_fp16_softmax(const ITensor *in, const ITensor *max, void *const tmp, ITensor *out, const float beta, bool is_log, const Window &window)
#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)
Set the input and output tensors.
static const std::vector< SoftmaxLogits1DMaxKernel > & get_available_kernels()
@ QASYMM8_SIGNED
quantized, asymmetric fixed-point 8-bit number signed
void neon_fp32_logits(const ITensor *in, ITensor *out, const Window &window)
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
void neon_fp16_logits(const ITensor *in, ITensor *out, const Window &window)
static const std::vector< SoftmaxLogits1DKernel > & get_available_kernels()
#define REGISTER_QASYMM8_SIGNED_SVE2(func_name)
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
static const auto * get_implementation(const SelectorType &selector, KernelSelectionType selection_type=KernelSelectionType::Supported)
Micro-kernel selector.
void configure(const ITensorInfo *src, const ITensorInfo *max, ITensorInfo *dst, const float beta, ITensorInfo *tmp)
Set the input and output tensors.
const Window & window() const
The maximum window the kernel can be executed on.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(...)
Information about executing thread and CPU.
void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
void neon_fp32_softmax(const ITensor *in, const ITensor *max, void *const tmp, ITensor *out, const float beta, bool is_log, const Window &window)
Store the tensor's metadata.
void sve_qasymm8_logits(const ITensor *in, ITensor *out, const Window &window)
void neon_qasymm8_singed_logits(const ITensor *in, ITensor *out, const Window &window)
Describe a multidimensional execution window.
void neon_qasymm8_softmax(const ITensor *in, const ITensor *max, void *const tmp, ITensor *out, const float beta, bool is_log, const Window &window)
Copyright (c) 2017-2023 Arm Limited.
#define REGISTER_FP16_SVE(func_name)
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(...)
@ F16
16-bit floating-point number
void sve2_qasymm8_softmax(const ITensor *in, const ITensor *max, void *const tmp, ITensor *out, const float beta, bool is_log, const Window &window)
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
const char * name() const override
Name of the kernel.
void sve_qasymm8_signed_logits(const ITensor *in, ITensor *out, const Window &window)
void neon_qasymm8_logits(const ITensor *in, ITensor *out, 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)
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
unsigned int num_elems_processed_per_iteration
void sve_fp32_logits(const ITensor *in, ITensor *out, const Window &window)
DataType
Available data types.
const char * name() const override
Name of the kernel.
#define REGISTER_QASYMM8_SVE2(func_name)