Details of the calculation when referencing a quantized TFLite CNN model
Hi @Truongdhvnu,

It's appreciable for your research interest on TFLite quantization. 

>How my data calculate thought these tensors with specific input value. And why is the last tensor look so strange (no name and all paramers are equal 0)

In the TFLite quantization process, the input values, weights and bias data types(float) at each layer are converted to  either to int8/int16/float16/...  during conversion depending on target device. The quantization might be symmetric(-127to +128) or affine(Unsymmetric 0-255) .  To know how  tensors are quantized, please refer [ link1](https://towardsdatascience.com/tensor-quantization-the-untold-story-d798c30e7646).

The last unnamed tensor might be an unused tensor created during the conversion process. 

>I tried to quantization with all parameters is uint8, but i can't find supported parameter to configure for converter

For more clear interpretation about tensors and their quantized values add the following command for tflite file.```tf.lite.experimental.Analyzer.analyze(model_content=tflite_quant_model) ```  and  use [link2](https://netron.app/) for better visualization of the quantized model .

```
interpreter = tf.lite.Interpreter(model_content=tflite_quant_model, experimental_preserve_all_tensors=True)
interpreter.allocate_tensors()
tensor_details = interpreter.get_tensor_details()
tf.lite.experimental.Analyzer.analyze(model_content=tflite_quant_model) 
```

Thank You



 This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62872">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62872">No</a>

### Issue type

Documentation Feature Request

### Have you reproduced the bug with TensorFlow Nightly?

No

### Source

source

### TensorFlow version

2.14.0

### Custom code

Yes

### OS platform and distribution

Window10

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

for the purpose of research and learning, I am trying to understand the series of mathematical operations needed to operate when using a CNN quantized model. I started with quantized conv2D layers.

I studied a [paper](https://arxiv.org/pdf/1712.05877.pdf) about the quantization method and inference method. As I understand, when operating conv2D, an affine function is applied to input data and kernels; then, we add bias to the result. Finally, we quantize the result to uint8 (also using an affine function), so the uint8 quantized result can be used for the next layer.

I created a very simple model that contains only one conv2D layer, with 1 input channel and 1 output channel. So, the only operation this layer performs is the convolution between the input and the simple kernel that I created.

```
input = np.array([[[[1] for _ in range(4)] for _ in range(4)]])
custom_matrix = np.array([[1,1,1], [0.5, 0.5, 0.5], [1, 1, 1]]).astype(np.float32)

custom_initializer = Constant(value=custom_matrix)
def creat_model():
    model = Sequential(
        [
             Conv2D(1, (3,3), padding="same", input_shape = (4,4,1),      kernel_initializer=custom_initializer),
           
        ]
    )
    return model

model = creat_model()
```

Then, i quantized the simple model

```
random_matrices = np.random.randint(0, 256, size=(50, 4, 4, 1))
print(random_matrices[0].shape)
x_train = random_matrices / 255.0
x_train = np.asarray(x_train).astype(np.float32)
x_train = np.asarray(x_train).astype(np.float32)
def representative_data_gen():
  for input_value in tf.data.Dataset.from_tensor_slices(x_train).batch(1).take(40):
    yield [input_value]

converter = tf.lite.TFLiteConverter.from_keras_model(model)

converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = representative_data_gen
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]
converter.inference_input_type = tf.uint8  
converter.inference_output_type = tf.uint8
tflite_quant_model = converter.convert()
```

I succesfully infer using this quantized model (the result of the origin model & of quantized model are quite the same).  
But when i print details about the quantized model using

```
interpreter = tf.lite.Interpreter(model_content=tflite_quant_model, experimental_preserve_all_tensors=True)
interpreter.allocate_tensors()
tensor_details = interpreter.get_tensor_details()

for tensor_detail in tensor_details:
    print(tensor_detail['index'], "   Name: ", tensor_detail["name"])
    print("     Quant_parameters:", tensor_detail["quantization"])
    print("     Type:", tensor_detail["dtype"])
```

The result is

```
0    Name:  serving_default_conv2d_4_input:0
     Quant_parameters: (0.003921568859368563, 0)
     Type: <class 'numpy.uint8'>
1    Name:  sequential_4/conv2d_4/BiasAdd/ReadVariableOp
     Quant_parameters: (3.0878494726493955e-05, 0)
     Type: <class 'numpy.int32'>
2    Name:  sequential_4/conv2d_4/Conv2D
     Quant_parameters: (0.007874015718698502, 0)
     Type: <class 'numpy.int8'>
3    Name:  tfl.quantize
     Quant_parameters: (0.003921568859368563, -128)
     Type: <class 'numpy.int8'>
4    Name:  StatefulPartitionedCall:01
     Quant_parameters: (0.023214150220155716, -128)
     Type: <class 'numpy.int8'>
5    Name:  StatefulPartitionedCall:0
     Quant_parameters: (0.023214150220155716, 0)
     Type: <class 'numpy.uint8'>
6    Name:  
     Quant_parameters: (0.0, 0)
     Type: <class 'numpy.int8'>
```

I tried to find documetation about these tensors for many days but i can't. I think that the first tensor is used to convert input value range from \[0,1\] to \[0,255\]. The second tensor for operating with bias parameters. The third tensor for convolution operation. But i don know how last tensors operate with their quantization parameters to get final result.

My questions is:

1. How my data calculate thought these tensors with specific input value. And why is the last tensor look so strange (no name and all paramers are equal 0)

2. I tried to quantization with all parameters is uint8, but i can't find supported parameter to configure for converter

I really need and will appreciate any help or suggestions I may receive. Thank you so much.

### Standalone code to reproduce the issue

```shell
(code above)
```


### Relevant log output

_No response_