Home
last modified time | relevance | path

Searched refs:zero_point (Results 1 – 25 of 82) sorted by relevance

1234

/external/tensorflow/tensorflow/lite/tools/optimize/
Dquantization_utils_test.cc71 ASSERT_EQ(params.zero_point.size(), 1); in TEST()
75 int64_t zero_point = params.zero_point[0]; in TEST() local
78 EXPECT_EQ(zero_point, 0); in TEST()
94 ASSERT_EQ(params.zero_point.size(), 1); in TEST()
97 int64_t zero_point = params.zero_point[0]; in TEST() local
100 EXPECT_EQ(zero_point, -128); in TEST()
116 ASSERT_EQ(params.zero_point.size(), 1); in TEST()
119 int64_t zero_point = params.zero_point[0]; in TEST() local
122 EXPECT_EQ(zero_point, 127); in TEST()
137 ASSERT_EQ(params.zero_point.size(), 1); in TEST()
[all …]
Dsubgraph_quantizer.cc37 const std::vector<int64_t>& zero_point, in AddQuantizationParams() argument
44 if (zero_point.size() != scales.size()) { in AddQuantizationParams()
47 tensor->quantization->zero_point.assign(zero_point.begin(), zero_point.end()); in AddQuantizationParams()
119 std::vector<int64_t> zero_point(scales.size(), 0); in SymmetricPerChannelQuantizeTensor() local
120 return AddQuantizationParams(scales, zero_point, channel_dim_index, in SymmetricPerChannelQuantizeTensor()
189 std::vector<int64_t> zero_point(scales.size(), 0); in SymmetricPerChannelBiasQuantize() local
190 return AddQuantizationParams(scales, zero_point, channel_dim_index, in SymmetricPerChannelBiasQuantize()
289 input_tensor->quantization->zero_point.size() != 1) { in PropagateMinMaxForAvgAndMaxPool()
302 quant_params->zero_point.push_back(input_tensor->quantization->zero_point[0]); in PropagateMinMaxForAvgAndMaxPool()
327 output_tensor->quantization->zero_point = {-128}; in AsymmetricQuantizeSoftmax()
Dquantization_utils.cc65 int64_t zero_point; in GetAsymmetricQuantizationParams() local
67 zero_point = static_cast<int64_t>(quant_min); in GetAsymmetricQuantizationParams()
69 zero_point = static_cast<int64_t>(quant_max); in GetAsymmetricQuantizationParams()
71 zero_point = static_cast<int64_t>(std::round(zero_point_from_min)); in GetAsymmetricQuantizationParams()
76 quantization_params->zero_point = std::vector<int64_t>(1, zero_point); in GetAsymmetricQuantizationParams()
188 tensor->quantization->zero_point = std::vector<int64_t>(1, 0); in SymmetricQuantizeTensor()
/external/tensorflow/tensorflow/lite/kernels/
Dkernel_util_test.cc162 input_params->zero_point = TfLiteIntArrayCreate(1); in TEST_F()
163 input_params->zero_point->data[0] = 5; in TEST_F()
184 filter_params->zero_point = TfLiteIntArrayCreate(3); in TEST_F()
185 filter_params->zero_point->data[0] = 0; in TEST_F()
186 filter_params->zero_point->data[1] = 0; in TEST_F()
187 filter_params->zero_point->data[2] = 0; in TEST_F()
205 bias_params->zero_point = TfLiteIntArrayCreate(3); in TEST_F()
206 bias_params->zero_point->data[0] = 11; in TEST_F()
207 bias_params->zero_point->data[1] = 12; in TEST_F()
208 bias_params->zero_point->data[2] = 15; in TEST_F()
[all …]
Dtest_util.h47 int32_t zero_point) { in Quantize() argument
53 std::round(zero_point + (f / scale)))))); in Quantize()
60 int32_t zero_point) { in Dequantize() argument
63 f.push_back(scale * (q - zero_point)); in Dequantize()
90 int32_t zero_point = 0, bool per_channel_quantization = false,
99 zero_point(zero_point), in type()
111 int32_t zero_point; member
182 auto q = Quantize<T>(data, t->params.scale, t->params.zero_point); in QuantizeAndPopulate()
241 int32_t GetZeroPoint(int id) { return tensor_data_.at(id).zero_point; } in GetZeroPoint()
356 int32_t zero_point = std::min( in QuantizationParams() local
[all …]
Dpad.cc189 TF_LITE_ENSURE(context, op_context.output->params.zero_point >= in Eval()
191 TF_LITE_ENSURE(context, op_context.output->params.zero_point <= in Eval()
193 pad_value = static_cast<uint8_t>(op_context.output->params.zero_point); in Eval()
197 TF_LITE_ENSURE_EQ(context, op_context.output->params.zero_point, in Eval()
198 op_context.constant_values->params.zero_point); in Eval()
222 TF_LITE_ENSURE(context, op_context.output->params.zero_point >= in Eval()
224 TF_LITE_ENSURE(context, op_context.output->params.zero_point <= in Eval()
226 pad_value = static_cast<int8_t>(op_context.output->params.zero_point); in Eval()
230 TF_LITE_ENSURE_EQ(context, op_context.output->params.zero_point, in Eval()
231 op_context.constant_values->params.zero_point); in Eval()
Dsub.cc95 input1_quantization_params.zero_point >= integer_type_min); in Prepare8BitSubOp()
97 input1_quantization_params.zero_point <= integer_type_max); in Prepare8BitSubOp()
99 input2_quantization_params.zero_point >= integer_type_min); in Prepare8BitSubOp()
101 input2_quantization_params.zero_point <= integer_type_max); in Prepare8BitSubOp()
103 output_quantization_params.zero_point >= integer_type_min); in Prepare8BitSubOp()
105 output_quantization_params.zero_point <= integer_type_max); in Prepare8BitSubOp()
107 op_params->input1_offset = -input1_quantization_params.zero_point; in Prepare8BitSubOp()
108 op_params->input2_offset = -input2_quantization_params.zero_point; in Prepare8BitSubOp()
109 op_params->output_offset = output_quantization_params.zero_point; in Prepare8BitSubOp()
156 TF_LITE_ENSURE_EQ(context, input1->params.zero_point, 0); in PrepareInt16SubOp()
[all …]
Dreduce.cc302 op_context.input->params.zero_point, op_context.input->params.scale, in EvalMean()
305 op_context.output->params.zero_point, in EvalMean()
324 GetTensorData<int8_t>(input), op_context.input->params.zero_point, in EvalMean()
327 op_context.output->params.zero_point); in EvalMean()
368 if (op_context.input->params.zero_point == in EvalMean()
369 op_context.output->params.zero_point && in EvalMean()
377 op_context.input->params.zero_point, in EvalMean()
381 op_context.output->params.zero_point, in EvalMean()
416 TF_LITE_ENSURE_EQ(context, op_context->input->params.zero_point, in EvalLogic()
417 op_context->output->params.zero_point); in EvalLogic()
[all …]
Dl2norm.cc57 TF_LITE_ENSURE_EQ(context, output->params.zero_point, 128); in Prepare()
60 TF_LITE_ENSURE_EQ(context, output->params.zero_point, 0); in Prepare()
95 op_params.input_zero_point = input->params.zero_point; \ in Eval()
115 reference_integer_ops::L2Normalization(input->params.zero_point, outer_size, in Eval()
Dactivations.cc68 TF_LITE_ENSURE_EQ(context, output->params.zero_point, 0); in CheckOutputQuantParams()
70 TF_LITE_ENSURE_EQ(context, output->params.zero_point, -128); in CheckOutputQuantParams()
149 TF_LITE_ENSURE_EQ(context, input->params.zero_point, 0); in TanhPrepare()
150 TF_LITE_ENSURE_EQ(context, output->params.zero_point, 0); in TanhPrepare()
185 TF_LITE_ENSURE_EQ(context, output->params.zero_point, in SigmoidPrepare()
189 TF_LITE_ENSURE_EQ(context, output->params.zero_point, in SigmoidPrepare()
212 TF_LITE_ENSURE_EQ(context, input->params.zero_point, 0); in SigmoidPrepare()
213 TF_LITE_ENSURE_EQ(context, output->params.zero_point, 0); in SigmoidPrepare()
276 TF_LITE_ENSURE_EQ(context, output->params.zero_point, 255); in LogSoftmaxPrepare()
279 TF_LITE_ENSURE_EQ(context, output->params.zero_point, 127); in LogSoftmaxPrepare()
[all …]
Dspace_to_batch_nd.cc138 op_context.output->params.zero_point); in Eval()
141 op_context.output->params.zero_point); in Eval()
147 op_context.output->params.zero_point); in Eval()
150 op_context.output->params.zero_point); in Eval()
Dadd.cc98 data->input1_offset = -input1->params.zero_point; in Prepare()
99 data->input2_offset = -input2->params.zero_point; in Prepare()
100 data->output_offset = output->params.zero_point; in Prepare()
139 TF_LITE_ENSURE_EQ(context, input1->params.zero_point, 0); in Prepare()
140 TF_LITE_ENSURE_EQ(context, input2->params.zero_point, 0); in Prepare()
141 TF_LITE_ENSURE_EQ(context, output->params.zero_point, 0); in Prepare()
Dconcatenation.cc95 TF_LITE_ENSURE_EQ(context, t->params.zero_point, in Prepare()
96 output->params.zero_point); in Prepare()
131 op_params.input_zeropoint = all_inputs.zero_point(); \ in Eval()
134 op_params.output_zeropoint = output->params.zero_point; \ in Eval()
Ddepthwise_conv.cc117 TF_LITE_ENSURE_EQ(context, bias->params.zero_point, 0); in Prepare()
229 auto input_offset = -input->params.zero_point; in EvalQuantized()
230 auto filter_offset = -filter->params.zero_point; in EvalQuantized()
231 auto output_offset = output->params.zero_point; in EvalQuantized()
281 op_params.input_offset = input->params.zero_point; in EvalQuantizedPerChannel()
283 op_params.output_offset = output->params.zero_point; in EvalQuantizedPerChannel()
Ddequantize_test.cc32 float scale, int32_t zero_point) { in DequantizeOpModel() argument
33 const TensorData input_tensor_data = {type, shape, 0, 0, scale, zero_point}; in DequantizeOpModel()
Dkernel_util.cc133 const auto zero_point = output->params.zero_point; in CalculateActivationRangeQuantizedImpl() local
135 auto quantize = [scale, zero_point](float f) { in CalculateActivationRangeQuantizedImpl()
136 return zero_point + static_cast<int32_t>(TfLiteRound(f / scale)); in CalculateActivationRangeQuantizedImpl()
/external/gemmlowp/doc/
Dquantization_example.cc66 std::uint8_t zero_point; member
110 result.zero_point = nudged_zero_point; in ChooseQuantizationParams()
138 const float transformed_val = qparams.zero_point + real_val / qparams.scale; in Quantize()
149 (*dst)[i] = qparams.scale * (quantized_val - qparams.zero_point); in Dequantize()
309 << ", zero_point = " << static_cast<float>(lhs_qparams.zero_point) in main()
313 << ", zero_point = " << static_cast<float>(rhs_qparams.zero_point) in main()
318 << static_cast<float>(result_qparams.zero_point) << std::endl; in main()
332 const int lhs_offset = -lhs_qparams.zero_point; in main()
333 const int rhs_offset = -rhs_qparams.zero_point; in main()
334 const int result_offset = result_qparams.zero_point; in main()
Dquantization.md80 In equation (1), plugging `real_value = 0` and `quantized_value = zero_point`,
84 0 = A * zero_point + B
90 zero_point = -B / A
95 `zero_point` can be exactly equal to it. Quite awkward!
98 `quantized_value = zero_point`, we get:
101 0 = C * (zero_point + D)
108 0 = zero_point + D
111 In other words, `D = -zero_point`. This suggests rewriting the quantization
116 real_value = scale * (quantized_value - zero_point) (3)
120 `-zero_point`.
[all …]
/external/tensorflow/tensorflow/lite/experimental/c/
Dc_api_test.cc64 EXPECT_EQ(input_params.zero_point, 0); in TEST()
86 EXPECT_EQ(output_params.zero_point, 0); in TEST()
123 EXPECT_EQ(input_params.zero_point, 0); in TEST()
139 EXPECT_EQ(output_params.zero_point, 0); in TEST()
149 output_params.scale * (output[0] - output_params.zero_point); in TEST()
151 output_params.scale * (output[1] - output_params.zero_point); in TEST()
/external/tensorflow/tensorflow/lite/testdata/
Dadd_quantized.json28 zero_point: [
52 zero_point: [
76 zero_point: [
/external/tensorflow/tensorflow/lite/kernels/internal/reference/integer_ops/
Ddequantize.h28 const int32 zero_point = op_params.zero_point; in Dequantize() local
34 const float result = static_cast<float>(scale * (val - zero_point)); in Dequantize()
/external/tensorflow/tensorflow/lite/toco/graph_transformations/
Dquantization_util.cc148 scaled_val = quantization_params.zero_point; in QuantizeBuffer()
150 scaled_val = quantization_params.zero_point + inverse_scale * src_val; in QuantizeBuffer()
180 ArrayDataTypeName(array.data_type), quantization_params.zero_point, in QuantizeArray()
235 array.minmax->max, quantization_params.zero_point, in IsArrayQuantizedRangeSubset()
251 (quantized_min - quantization_params.zero_point) * in IsArrayQuantizedRangeSubset()
263 (quantized_max - quantization_params.zero_point) * in IsArrayQuantizedRangeSubset()
Dquantize.cc230 quantization_params->zero_point = 0; in ChooseQuantizationForOperatorInput()
257 ArrayDataTypeName(array.final_data_type), quantization_params->zero_point, in ChooseQuantizationForOperatorInput()
265 quantization_params.zero_point + real_value / quantization_params.scale; in IsExactlyRepresentable()
290 quantization_params->zero_point = qp.central_value; in ChooseHardcodedQuantizationForOperatorOutput()
305 quantization_params->zero_point = 0; in ChooseHardcodedQuantizationForOperatorOutput()
315 quantization_params->zero_point = qp.max_value; in ChooseHardcodedQuantizationForOperatorOutput()
328 quantization_params->zero_point = qp.central_value; in ChooseHardcodedQuantizationForOperatorOutput()
378 quantization_params->zero_point = input_quantization_params.zero_point; in ChooseQuantizationForOperatorOutput()
405 quantization_params->zero_point, quantization_params->scale); in ChooseQuantizationForOperatorOutput()
425 double min = (quantized_min - quantization_params.zero_point) * in FixMinMaxPostQuantization()
[all …]
/external/tensorflow/tensorflow/lite/toco/tflite/
Dimport.cc89 if (quantization->scale() && quantization->zero_point()) { in ImportTensors()
91 CHECK_EQ(1, quantization->zero_point()->Length()); in ImportTensors()
94 q.zero_point = quantization->zero_point()->Get(0); in ImportTensors()
/external/tensorflow/tensorflow/lite/c/
Dc_api_internal.c102 if (q_params->zero_point) { in TfLiteQuantizationFree()
103 TfLiteIntArrayFree(q_params->zero_point); in TfLiteQuantizationFree()
104 q_params->zero_point = NULL; in TfLiteQuantizationFree()

1234