18 if (unaryDescriptor->
m_Operation != UnaryOperation::Log)
20 throw armnn::Exception(
"ConvertLogOperator: Unsupported elementwise unary operation in descriptor.");
23 std::string inputName = std::string(
"input_");
24 std::string outputName = std::string(
"output0_");
35 std::vector<TosaSerializationTensor*> tensors;
36 std::vector<TosaSerializationOperator*> operators;
38 float input_scale = inputs[0]->GetQuantizationScale();
39 float output_scale = outputs[0]->GetQuantizationScale();
40 int32_t input_zp = inputs[0]->GetQuantizationOffset();
41 int32_t output_zp = outputs[0]->GetQuantizationOffset();
42 DataType inputDType = inputs[0]->GetDataType();
44 if (inputDType == DataType::QAsymmS8 ||
45 inputDType == DataType::QSymmS8)
47 const float output_min =
static_cast<float>(-128 - output_zp) * output_scale;
49 auto log_func = [&](
float x) ->
float
58 TosaTableAttribute attribute(
60 operators.push_back(
new TosaSerializationOperator(tosa::Op_TABLE,
61 Attribute_TableAttribute,
66 else if (inputDType == DataType::QSymmS16)
68 throw Exception(
"ConvertLogOperator() unsupported int 16 not implemented yet.");
94 else if (inputDType == DataType::Signed32 ||
95 inputDType == DataType::Signed64)
98 "ConvertLogOperator() unsupported int 32. Only int 8 and int 16 quantized types are supported.");
103 operators.push_back(
new TosaSerializationOperator(tosa::Op_LOG,
113 if(inputName.find(
"input_") != std::string::npos)
117 tensors.push_back(
new TosaSerializationTensor(inputName, inputShape0, inputDType0, {}));
125 DType outputDType0 =
ArmNNToDType(outputs[0]->GetDataType());
127 tensors.push_back(
new TosaSerializationTensor(outputName, outputShape0, outputDType0, {}));
131 return new TosaSerializationBasicBlock(blockName,