When converting to tflite Input/Output tensor names are present in the signature but not maintained
Hi @fixedit-dimitris ,
Could you please provide ```reshape_v2_finetuned``` model to reproduce the code.
Thank You > Hi @fixedit-dimitris , Could you please provide `reshape_v2_finetuned` model to reproduce the code. Thank You

Hi there, unfortunately i cannot share that. However I managed to solve the issue by converting using a concrete function.
```
@tf.function(input_signature=[tf.TensorSpec(shape=[None, 244,244,1], dtype=tf.float32)])
def rename_serve(input_tensor):
    out0, out1 = model(input_tensor)
    return {"classifier": out0, "regressor": out1}

my_signatures = rename_serve.get_concrete_function()

# Save the functional model with the signature definition
export_dir = "./signature_saved_model/"
tf.saved_model.save(model, export_dir, signatures= my_signatures)
```

```# Convert to tflite
# a model different from the one defined in the example!
def a_representative_datagenerator(n_samples_to_yield=160):
    """ A data generator which produces samples from the model's domain.
        Calling this generator should output samples of the same type
        and shape as the inputs to the model, similar to those it has been
        trained on.

        Args:
            n_samples_to_yield (int): The number of samples for this generator
                to yield.

    Yields:
        np.float32 array: An RGB image from the dataset directory, which has
            been processed like the images the model has been
            trained on. In this case, this includes
            normalization and resizing. The output array has the
            shape (1, 244, 244, 1).
    """
    samples = glob.glob(os.path.join('train_samples', '*'))
    sample_set = np.random.choice(samples, size=n_samples_to_yield,
                                  replace=False)
    for sample_path in sample_set:
        sample = Image.open(sample_path)
        preprocessed_sample = np.array(sample, dtype=np.float32) / 255.
        preprocessed_sample = np.expand_dims(preprocessed_sample, axis=0) # Batch
        preprocessed_sample = np.expand_dims(preprocessed_sample, axis=-1) # Channel
        yield [preprocessed_sample]

conc_func = loaded_model.signatures[tf.saved_model.DEFAULT_SERVING_SIGNATURE_DEF_KEY]        

# Create the converter. As the model to convert is of the
# SavedModel format, the from_saved_model function is used
# converter = tf.lite.TFLiteConverter.from_saved_model('reshape_v2_finetuned/', signature_keys=['serving_default'])
converter = tf.lite.TFLiteConverter.from_concrete_functions([conc_func])

# Flags which set what optimizations to perform. The DEFAULT flag
# enables quantization of all fixed parameters, such as weights
converter.optimizations = [tf.lite.Optimize.DEFAULT]

# Set the converter to use the data generator defined above
converter.representative_dataset = a_representative_datagenerator

# Select the set of operators to use
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8] 
converter.inference_input_type = tf.uint8


# Perform the conversion
tflite_model = converter.convert()

# Write the converted model to disk
open('converted_model.tflite', "wb").write(tflite_model)```

This gives the following outputs: 
```Input name is: input_tensor
Output names are: ['Identity', 'Identity_1']```

### 1. System information

- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 22.04
- TensorFlow installation (pip package or built from source): pip
- TensorFlow library (version, if pip package or github SHA, if built from source): 2.15

### 2. Code
```
import tensorflow as tf 
from tensorflow import keras 
import glob
import os
import numpy as np
from PIL import Image

model = keras.models.load_model("reshape_v2_finetuned/")
model.summary()

def a_representative_datagenerator(n_samples_to_yield=160):
    samples = glob.glob(os.path.join("train_samples", "*"))
    sample_set = np.random.choice(samples, size=n_samples_to_yield,
                                  replace=False)
    for sample_path in sample_set:
        sample = Image.open(sample_path)
        preprocessed_sample = np.array(sample, dtype=np.float32) / 255.
        preprocessed_sample = np.expand_dims(preprocessed_sample, axis=0) # Batch
        preprocessed_sample = np.expand_dims(preprocessed_sample, axis=-1) # Channel
        yield [preprocessed_sample]

converter = tf.lite.TFLiteConverter.from_saved_model('reshape_v2_finetuned/', signature_keys=['serving_default'])

converter.optimizations = [tf.lite.Optimize.DEFAULT]

converter.representative_dataset = a_representative_datagenerator
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8] 
tflite_model = converter.convert()

open("converted_model.tflite", "wb").write(tflite_model)

interpreter = tf.lite.Interpreter(model_content=tflite_model)
print('\nInput name is:', interpreter.get_input_details()[0]['name'])
print("Output names are:", [output["name"] for output in interpreter.get_output_details()])

signatures = interpreter.get_signature_list()
print(signatures)
```

### Returns: 
``` 
Input name is: serving_default_input:0
Output names are: [StatefulPartitionedCall:0, StatefulPartitionedCall:1]
{serving_default: {inputs: [input], outputs: [A_regressor_head, B_classifier_head]}}
```

### 5. Ideal result

Input/Output names same as the ones in the signature def.  Is this something that can be done (as when converting with the Ambarella toolchain for CV25 this appears to be an issue due to the extra :0 tag) ?
