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

Method configure

src/cpu/kernels/CpuMulKernel.cpp:1560–1727  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1558} // namespace
1559
1560void CpuMulKernel::configure(ITensorInfo *src1,
1561 ITensorInfo *src2,
1562 ITensorInfo *dst,
1563 float scale,
1564 ConvertPolicy overflow_policy,
1565 RoundingPolicy rounding_policy)
1566{
1567 ARM_COMPUTE_UNUSED(rounding_policy);
1568 ARM_COMPUTE_ERROR_ON_NULLPTR(src1, src2, dst);
1569
1570 ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(src1, src2, dst, scale, overflow_policy, rounding_policy));
1571
1572 const TensorShape &out_shape = TensorShape::broadcast_shape(src1->tensor_shape(), src2->tensor_shape());
1573
1574 // Auto initialize dst if not initialized
1575 set_shape_if_empty(*dst, out_shape);
1576
1577 _scale = scale;
1578 _scale_exponent = 0;
1579 _func_quantized = nullptr;
1580 _func_int = nullptr;
1581 _func_float = nullptr;
1582
1583 bool is_scale_255 = false;
1584 // Check and validate scaling factor
1585 if (std::abs(scale - scale255_constant) < 0.00001f)
1586 {
1587 is_scale_255 = true;
1588 }
1589 else
1590 {
1591 int exponent = 0;
1592
1593 std::frexp(scale, &exponent);
1594
1595 // Store the positive exponent. We know that we compute 1/2^n
1596 // Additionally we need to subtract 1 to compensate that frexp used a mantissa of 0.5
1597 _scale_exponent = std::abs(exponent - 1);
1598 }
1599
1600 const DataType dt_input1 = src1->data_type();
1601 const DataType dt_input2 = src2->data_type();
1602 const DataType dt_output = dst->data_type();
1603 const bool is_sat = (overflow_policy == ConvertPolicy::SATURATE);
1604
1605 switch (dt_input1)
1606 {
1607 case DataType::QASYMM8:
1608 if (dt_input2 == DataType::QASYMM8 && dt_output == DataType::QASYMM8)
1609 {
1610 if (mul_q8_neon_fixedpoint_possible(src1, src2, dst, scale))
1611 {
1612 _func_quantized = &mul_q8_neon_fixedpoint<uint8_t>;
1613 }
1614 else
1615 {
1616 _func_quantized = &mul_saturate_quantized_8<uint8_t>;
1617 }

Callers

nothing calls this directly

Calls 12

set_shape_if_emptyFunction · 0.85
absFunction · 0.85
frexpFunction · 0.85
mul_q8_sme_possibleFunction · 0.85
auto_init_if_emptyFunction · 0.85
validate_argumentsFunction · 0.70
calculate_max_windowFunction · 0.50
data_typeMethod · 0.45
num_channelsMethod · 0.45

Tested by

no test coverage detected