PadV2 constant_values tensor not quantized using 16x8 quantization mode
Hi @riestmo-nxp ,

The error for the model_int16.tflite has been replicated. 
![Screenshot 2023-12-02 11 39 41 AM](https://github.com/tensorflow/tensorflow/assets/149650845/2caec509-a657-4cb5-89df-4a99e5c695b0) It might be incompatibilities between input and padding data types. Please check the incompatibilities and let us know if the issue still persists.


Thank You





 Hi @LakshmiKalaKadali,
thanks for reproducing the issue. I think the incompatibilities between the input (int16) and the padding data (float) must be introduced by the TFLiteConverter. As previously mentioned, the TFLiteConverter quantizes both, the input and the constant_values tensor, to int8 in int8 quantization mode. However, it only quantizes the input to int16 and keeps the constant_values tensor in float32 during quantization in int16x8 quantization mode. The expected behavior would be that both, the input and the constant_values tensor, get quantized to int16 in int16x8 quantization mode. Therefore I am not sure how I could further investigate the incompatibilities. Any hints from your side? Thanks! Hi @riestmo-nxp ,

1. Your model_int16.tflite file is  quantizing PadV2  to  int16  and it is working as expected.  We have to observe the quantized value at the "output of PadV2 node". Please find the screenshot. 
![image](https://github.com/tensorflow/tensorflow/assets/149650845/fc4a5844-b6d4-4f74-85e5-da8497d16d2f). 
2.  Regarding incompatibility between input and output data types at Padv2(Inputs: Constant values- flaot32) node  is due to  setting ```constant_values = -1``` in your code. The model is also working as expected for  ```constant_values = 0`` 

Thank You
 Hi @LakshmiKalaKadali,

1. I agree that the input (Input 1) and the output of the PadV2 operator is quantized to int16 as expected. However, the issue during runtime is caused between the different data types of Input 1 and Input 3 (constant_values).

1. When setting "constant_values = 0", the resulting operator in the tflite model is the Pad operator and not the PadV2 operator. Therefore this does not really help to solve this issue. I would still like to be able to set any other value than 0 as constant_values and get a running tflite model with int16 inputs and outputs. Do you see any solution for this? @pkgoogle, 

Please look into the issue.

Thank You Hi @abattery, can you please take a look? Thanks. Hi @riestmo-nxp , if you are able to access a linux system you may be able to resolve your issue by using [AI-Edge-Torch](https://github.com/google-ai-edge/ai-edge-torch), you can find more information here: [googleblog](https://developers.googleblog.com/en/ai-edge-torch-high-performance-inference-of-pytorch-models-on-mobile-devices/).

I have actually created a simple script for converting your model here, also for further quantization details, please follow [this](https://github.com/google-ai-edge/ai-edge-torch/blob/main/docs/pytorch_converter/README.md#quantization)


```
import torch
import torch.nn as nn
import torch.nn.functional as F
import ai_edge_torch

class PadLayer(nn.Module):
    def __init__(self):
        super(PadLayer, self).__init__()
        self.paddings = (0, 0, 1, 1)  # Padding for the second and third dimensions

    def forward(self, x):
        return F.pad(x, pad=self.paddings, mode="constant", value=-1)

class SimpleModel(nn.Module):
    def __init__(self):
        super(SimpleModel, self).__init__()
        self.conv = nn.Conv2d(in_channels=1, out_channels=16, kernel_size=(1, 7), padding='same')
        self.pad = PadLayer()
        self.mpool = nn.MaxPool2d(kernel_size=(1, 3), stride=(1, 2), padding=0)

    def forward(self, x):
        x = self.conv(x)
        x = self.pad(x)
        x = self.mpool(x)
        return x

model = SimpleModel()

example_input = torch.randn(1, 1, 32, 25)

edge_model = ai_edge_torch.convert(model.eval(), (example_input,))

# Export the model to TFLite format
edge_model.export('simple_model_with_pad.tflite')
```
If you want to, you can actually try visualizing the result in [model-explorer](https://github.com/google-ai-edge/model-explorer) as well.

Please try them out and let us know if this resolves your issue. If you still need further help, feel free to open a new issue at the respective repo.

### 1. System information

- OS Platform and Distribution: Ubuntu 22.04.3
- TensorFlow installation: pip package
- TensorFlow library: 2.15.0
 
### 2. Code
Please see the attached PadV2Issue.ipynb notebook for reproducing the issue. It creates a dummy model that contains a pad operator with constant -1. This translates into a PadV2 operator in the tflite model. 
[PadV2Issue.zip](https://github.com/tensorflow/tensorflow/files/13498177/PadV2Issue.zip)

### 3. Failure after conversion
In the generated model_int8.tflite, the _constant_values_ tensor is correctly quantized to int8. 
However, in model_int16.tflite the _constant_values_ tensor is not quantized at all and remains a float32 tensor after conversion.

![PadV2Issue](https://github.com/tensorflow/tensorflow/assets/149694071/343dfd3a-1e67-470c-945a-95ad976b1a4d)

Eventually, this causes a runtime error during inference.

The expected behavior of the converter for the 16x8 quantization mode would either be to quantize the _constant_values_ tensor to int16 or, if it is intentionally not supported, to throw an error already during conversion.

Does anybody know what can be done to fix this issue?
