The required input dimension and type changed after conversion of SAC algorithm
Hi @urplanet 

Could you please provide the minimal reproducible code for the colab environment?

Facing errors while executing the provided code.

Thanks. Hi @pjpratik  
as requested, I have updated the code in the colab https://colab.research.google.com/drive/1Eea5Fi861_h3TzH1eGUaP-H9dSPBn3OJ?usp=sharing . I included the environment I used to run the training.
 Hi @urplanet 

Thanks for the code.

I have observed that `observation` has been converted with shape signature `[-1,5]` with type FLOAT32 using TFLite [Model Analyzer](https://www.tensorflow.org/lite/guide/model_analyzer) API.

The model has 
```
Observation Spec:
BoundedArraySpec(shape=(5,), dtype=dtype('float32'), name='observation', minimum=0.0, maximum=1.0)
```
and as per model analyzer
```
  T#0(action_0_step_type:0) shape_signature:[-1], type:INT32
  T#1(action_0_discount:0) shape_signature:[-1], type:FLOAT32
  T#2(action_0_observation:0) shape_signature:[-1, 5], type:FLOAT32
  T#3(action_0_reward:0) shape_signature:[-1], type:FLOAT32
```
Please find the gist [here](https://colab.research.google.com/gist/pjpratik/52b533b493930883b98ea3ef91dc2174/61260.ipynb).

Thanks.
 So could you advice that this issue occurs because of incompatibility of the model or which root causes ? Because my conversion is very simple without any change in the conversion configuration. Hi @urplanet 

Based on the above gist, I don't see any issue in conversion process as the input shapes are not altered.

You have to access `input_details[2]['shape']` and `input_details[2]['index']`, if the `observation` data is of the interest.

```
# Create random input data with shape [1, 5]
input_shape = input_details[2]['shape']
input_data = np.random.random_sample(input_shape).astype(np.float32) 
print("Input data: \n", input_data)
print("Input shape:", input_shape)
# Set input tensor to the random input data
interpreter.set_tensor(input_details[2]['index'], input_data)
interpreter.invoke()
```

Thanks. that solved my problem. thank you so much !

meanwhile, I have a small question on the Saved Model selection. I followed this https://www.tensorflow.org/agents/tutorials/7_SAC_minitaur_tutorial and realized that there are different Saved_Model.pb in different folder in the tempdir.

if I would like to convert the policy for further use in TFLite, which one I should pick to convert to represent my trained SAC Model ? Hi @urplanet 

The Tensorflow Agents is being maintained as separate [repo](https://github.com/tensorflow/agents). Could you please raise a ticket there for faster resolution?

Please, let us know if we can help anything on TFLite.

Feel free to close the issue if it is resolved.

Thanks. 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/61260">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/61260">No</a>

### 1. System information

- OS Platform and Distribution : Linux Ubuntu 22.04
- TensorFlow installation : Pip Package
- TensorFlow library: Tensorflow 2.12.1

### 2. Code
most of them I followed the SAC Minitaur tutorial here https://www.tensorflow.org/agents/tutorials/7_SAC_minitaur_tutorial but with some modification to fit with my environment, also with additional function to convert to TFLite 
https://colab.research.google.com/drive/1Eea5Fi861_h3TzH1eGUaP-H9dSPBn3OJ?usp=sharing

### 3. Failure after conversion
The Observation Spec reduced and changed from shape (5,), float32 to shape[1], int32 in this conversion

> Observation Spec:
BoundedArraySpec(shape=(5,), dtype=dtype('float32'), name='observation', minimum=0.0, maximum=1.0)
Reward Spec:
ArraySpec(shape=(), dtype=dtype('float32'), name='reward')
Action Spec:
BoundedArraySpec(shape=(1,), dtype=dtype('float32'), name='action', minimum=-0.6000000238418579, maximum=0.6000000238418579)
Time step:
TimeStep(
{'discount': array(1., dtype=float32),
 'observation': array([0.09387773, 0.45744053, 0.8837498 , 0.84389937, 0.5       ],
      dtype=float32),
 'reward': array(0., dtype=float32),
 'step_type': array(0, dtype=int32)}) 
step = 0: AverageReturn = 0.000758, AverageEpisodeLength = 120.449997
step = 100: loss = -0.29556670784950256
step = 200: loss = -0.42344561219215393
step = 300: loss = -0.4886786639690399
step = 400: loss = -0.5600587129592896
step = 500: loss = -0.6421032547950745
step = 600: loss = -0.7184216380119324
step = 700: loss = -0.785315752029419
step = 800: loss = -0.8600273728370667
step = 900: loss = -0.9031595587730408
step = 1000: AverageReturn = 1.299191, AverageEpisodeLength = 115.500000
step = 1000: loss = -0.990966796875  
Policy Saved at  /home/erde/minipads/sim/experiment/RL_Ctler/tf_exp/temp_sac/policy
#################### Convert to TFlite
Input shape: {'arg_0_discount': TensorSpec(shape=(None,), dtype=tf.float32, name='0/discount'), 'arg_0_observation': TensorSpec(shape=(None, 5), dtype=tf.float32, name='0/observation'), 'arg_0_reward': TensorSpec(shape=(None,), dtype=tf.float32, name='0/reward'), 'arg_0_step_type': TensorSpec(shape=(None,), dtype=tf.int32, name='0/step_type')}
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Input details: 
 [{'name': 'action_0_step_type:0', 'index': 0, 'shape': array([1], dtype=int32), 'shape_signature': array([-1], dtype=int32), 'dtype': <class 'numpy.int32'>, 'quantization': (0.0, 0), 'quantization_parameters': {'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}, {'name': 'action_0_discount:0', 'index': 1, 'shape': array([1], dtype=int32), 'shape_signature': array([-1], dtype=int32), 'dtype': <class 'numpy.float32'>, 'quantization': (0.0, 0), 'quantization_parameters': {'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}, {'name': 'action_0_observation:0', 'index': 2, 'shape': array([1, 5], dtype=int32), 'shape_signature': array([-1,  5], dtype=int32), 'dtype': <class 'numpy.float32'>, 'quantization': (0.0, 0), 'quantization_parameters': {'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}, {'name': 'action_0_reward:0', 'index': 3, 'shape': array([1], dtype=int32), 'shape_signature': array([-1], dtype=int32), 'dtype': <class 'numpy.float32'>, 'quantization': (0.0, 0), 'quantization_parameters': {'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}]
Output details: 
 [{'name': 'StatefulPartitionedCall:0', 'index': 92, 'shape': array([1, 1], dtype=int32), 'shape_signature': array([-1, -1], dtype=int32), 'dtype': <class 'numpy.float32'>, 'quantization': (0.0, 0), 'quantization_parameters': {'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}]
Input data: 
 [0]
Input shape: [1]
Output data: 
 [[-0.6]]

- The converted model has less dimension input and different input type required
