MCPcopy Create free account
hub / github.com/OAID/Tengine / get_scale_zero

Function get_scale_zero

executor/operator/ref/ref_eltwise.cpp:59–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57 }
58};
59static int get_scale_zero(Tensor* itensor, Tensor* otensor, eltwise_param* param)
60{
61 auto* i_quant = itensor->GetQuantParam();
62 auto* o_quant = otensor->GetQuantParam();
63 if(i_quant->size() != 1)
64 {
65 LOG_ERROR() << "Input quant size: (" << i_quant->size() << ")\n";
66 return -1;
67 }
68 param->scale[0] = (*i_quant)[0].scale;
69 if(itensor->GetDataType() == TENGINE_DT_UINT8)
70 {
71 if(o_quant->size() != 1)
72 {
73 LOG_ERROR() << "Output quant size: (" << o_quant->size() << ")\n";
74 return -1;
75 }
76
77 param->scale[2] = (*o_quant)[0].scale;
78 param->zero[2] = (*o_quant)[0].zero_point;
79
80 param->zero[0] = (*i_quant)[0].zero_point;
81 }
82
83 return 0;
84}
85static int get_scale_zero_1(Tensor* itensor, eltwise_param* param)
86{
87 auto* i_quant = itensor->GetQuantParam();

Callers 1

RunMethod · 0.70

Calls 3

GetQuantParamMethod · 0.80
GetDataTypeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected