MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / configure

Method configure

src/cpu/operators/CpuSoftmax.cpp:49–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void 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
90Status
91CpuSoftmaxGeneric::validate(const ITensorInfo *src, const ITensorInfo *dst, float beta, int32_t axis, bool is_log)

Callers

nothing calls this directly

Calls 10

wrap_aroundFunction · 0.85
MemoryInfoClass · 0.85
offset_int_vecFunction · 0.85
validateFunction · 0.50
TensorInfoClass · 0.50
num_dimensionsMethod · 0.45
data_typeMethod · 0.45
cloneMethod · 0.45
total_sizeMethod · 0.45

Tested by

no test coverage detected