| 47 | } |
| 48 | |
| 49 | void CpuSoftmaxGeneric::configure(const ITensorInfo *src, ITensorInfo *dst, float beta, int32_t axis, bool is_log) |
| 50 | { |
| 51 | ARM_COMPUTE_TRACE_EVENT(ARM_COMPUTE_PROF_CAT_CPU, ARM_COMPUTE_PROF_LVL_CPU, "CpuSoftmaxGeneric::configure"); |
| 52 | // Perform validation step |
| 53 | ARM_COMPUTE_ERROR_ON_NULLPTR(src, dst); |
| 54 | ARM_COMPUTE_ERROR_THROW_ON(CpuSoftmaxGeneric::validate(src, dst, beta, axis, is_log)); |
| 55 | ARM_COMPUTE_LOG_PARAMS(src, dst, beta, axis); |
| 56 | |
| 57 | const unsigned int actual_axis = |
| 58 | static_cast<unsigned int>(wrap_around(axis, static_cast<int32_t>(src->num_dimensions()))); |
| 59 | |
| 60 | _axis = actual_axis; |
| 61 | |
| 62 | const ITensorInfo *tmp_input = src; |
| 63 | |
| 64 | TensorInfo tensor_info_tmp; |
| 65 | if (is_data_type_quantized_asymmetric(src->data_type())) |
| 66 | { |
| 67 | // Create intermediate tensors shapes |
| 68 | const TensorInfo input_info = tmp_input->clone()->reset_padding().set_is_resizable(true); |
| 69 | tensor_info_tmp = input_info.clone()->set_data_type(DataType::F32); |
| 70 | } |
| 71 | |
| 72 | // Init intermediate tensors |
| 73 | _tmp = TensorInfo(tensor_info_tmp); |
| 74 | |
| 75 | // Configure kernels |
| 76 | auto sm = std::make_unique<kernels::CpuSoftmaxKernel>(); |
| 77 | |
| 78 | // Softmax 2D case |
| 79 | sm->configure(tmp_input, dst, beta, is_log, actual_axis, &_tmp); |
| 80 | |
| 81 | _softmax_kernel = std::move(sm); |
| 82 | |
| 83 | if (_tmp.total_size() > 0) |
| 84 | { |
| 85 | _aux_mem[InternalTensorIdx::TMP] = |
| 86 | MemoryInfo(offset_int_vec(InternalTensorIdx::TMP), MemoryLifetime::Temporary, _tmp.total_size()); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | Status |
| 91 | CpuSoftmaxGeneric::validate(const ITensorInfo *src, const ITensorInfo *dst, float beta, int32_t axis, bool is_log) |
nothing calls this directly
no test coverage detected