  File "/usr/local/lib/python3.8/dist-packages/tensorflow/lite/python/interpreter.py", line 915, in invoke     self._interpreter.Invoke() RuntimeError: tensorflow/lite/kernels/concatenation.cc:158 t->dims->data[d] != t0->dims->data[d] (1 != 2)Node number 304 (CONCATENATION) failed to prepare.
Hi @Mayi-Keiji 

The input shape of the Keras model is observed as `(None,None,None,3)` and when converted to TFLite model it becomes shape `(1,1,1,3)`

If you want to run a model with dynamic input shape, resize the input shape before running inference. Otherwise, the None shape in Tensorflow models will be replaced by a placeholder of 1 in TFLite models.

Resizing the tensor with specific shape should solve the problem.

```
interpreter = tf.lite.Interpreter(model_path="model.tflite")
interpreter.resize_tensor_input(interpreter.get_input_details()[0]['index'], [1,224,224,3])
interpreter.allocate_tensors()

# Get input and output tensors.
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
print(input_details)

# Test the model on random input data.
input_shape = [1,224,224,3]
input_data = np.array(np.random.random_sample(input_shape), dtype=np.float32)
interpreter.set_tensor(input_details[0]['index'], input_data)

interpreter.invoke()

# The function `get_tensor()` returns a copy of the tensor data.
# Use `tensor()` in order to get a pointer to the tensor.
output_data = interpreter.get_tensor(output_details[0]['index'])
print(output_data)
```

Please find this resolved [gist](https://colab.research.google.com/gist/pjpratik/d4c86f7ccf73cb2d82ee592dd83e7ed9/61664.ipynb) for the same and let us know if it helps.

Thanks. 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. I had the same issue and it was related to the input shape.  @pjpratik thanks for helping me realise that! @NIKovachev Glad it helped.

@Mayi-Keiji Feel free to close the issue if it is resolved.

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

### 1. System information
![image](https://github.com/tensorflow/tensorflow/assets/35233355/cfc8e9d3-9790-4a89-86db-062b97d3bbbc)

- OS Platform and Distribution (Linux Ubuntu 20.04):
- TensorFlow installation (2.9.1+nv22.9):

### 2. Code
`import numpy as np
import tensorflow as tf

def main():
    # Load the TFLite model and allocate tensors.
    interpreter = tf.lite.Interpreter(model_path="model.tflite")
    interpreter.allocate_tensors()
    
    #return

    # Get input and output tensors.
    input_details = interpreter.get_input_details()
    output_details = interpreter.get_output_details()
    # Test the model on random input data.

    input_shape = input_details[0]['shape']
    input_data = np.array(np.random.random_sample(input_shape), dtype=np.float32)
    #interpreter.set_tensor(input_details[0]['index'], input_data)

    signatures = interpreter.get_signature_list()
    print(signatures)

    interpreter.invoke()
    return
    # The function `get_tensor()` returns a copy of the tensor data.
    # Use `tensor()` in order to get a pointer to the tensor.
    output_data = interpreter.get_tensor(output_details[0]['index'])
    print(output_data)


if __name__ == '__main__':
    main()`

**How to get the model:**
I used a library here to get a unet with efficientnetb0 as encoder
https://github.com/qubvel/segmentation_models.
So you can try to use my script to get the model:
`    BACKBONE = 'efficientnetb0'
    BATCH_SIZE = 1
    CLASSES = ["background", "target", "others"]
    LR = 0.0001
    EPOCHS = 10

    preprocess_input = sm.get_preprocessing(BACKBONE)

    # define network parameters
    n_classes = 1 if len(CLASSES) == 1 else (len(CLASSES) + 1)  # case for binary and multiclass segmentation
    activation = 'sigmoid' if n_classes == 1 else 'softmax'

    #create model
    model = sm.Unet(BACKBONE, classes=n_classes, activation=activation)`

