Type INT32 (2) not supported.Node ADD (number 0) failed to invoke with status 1.Node WHILE (number 10) failed to invoke with status 1
@Fabiran 
Could you please provide a reproducible code or a toy example to reproduce the issue reported here ?

Thank you! Hi, @tiruk007, here is my data [N6.csv](https://github.com/tensorflow/tensorflow/files/11049537/N6.csv) and code.
## model process
import time
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.metrics import mean_squared_error, mean_absolute_error
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from tensorflow.python.keras.layers import LSTM, Dense, Dropout
from tensorflow.python.keras.models import Sequential

#read data
data = pd.read_csv('N6.csv')

data_HR = data['HR'].values

#z_escore
scaler = StandardScaler()
scaler.fit(data_HR.reshape(-1, 1))
data_std = scaler.transform(data_HR.reshape(-1, 1))

#split
data_for_training, data_for_testing = train_test_split(data_std, test_size=0.2, shuffle=False)

data_for_training, data_for_val = train_test_split(data_for_training, test_size=0.2, shuffle=False)


def createXY(dataset, n_past):
    dataX = []
    dataY = []
    for i in range(n_past, len(dataset)):
        dataX.append(dataset[i - n_past:i])
        dataY.append(dataset[i])
    return np.array(dataX), np.array(dataY)


window_size = 30

trainX, trainY = createXY(data_for_training, window_size)
valX, valY = createXY(data_for_val, window_size)
testX, testY = createXY(data_for_testing, window_size)

#reshape to 3D
trainX = np.reshape(trainX, (trainX.shape[0], trainX.shape[1], 1))
valX = np.reshape(valX, (valX.shape[0], valX.shape[1], 1))
testX = np.reshape(testX, (testX.shape[0], testX.shape[1], 1))

#build model
model = Sequential()
model.add(LSTM(30, activation='relu', return_sequences=False, input_shape=(window_size, 1)))
model.add(Dropout(0.2))
model.add(Dense(1))
model.compile(loss='mean_squared_error', optimizer='adam')

epochs = 25
history = model.fit(trainX, trainY, epochs=epochs, batch_size=32, verbose=1, validation_data=(valX, valY))

model.summary()

prediction_std = model.predict(testX)
prediction = scaler.inverse_transform(prediction_std)

#convert into tflite
converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
tflite_model = converter.convert()
with open(f"model1.tflite", "wb") as f:
    f.write(tflite_model)


## arduino nano 33 ble sense

#include <TensorFlowLite.h>
#include "model.h"
#include "tensorflow/lite/micro/all_ops_resolver.h"
#include "tensorflow/lite/micro/micro_interpreter.h"
#include "tensorflow/lite/micro/micro_log.h"
#include "tensorflow/lite/micro/system_setup.h"
#include "tensorflow/lite/schema/schema_generated.h"


// Globals, used for compatibility with Arduino-style sketches.
namespace {
const tflite::Model* model = nullptr;
tflite::MicroInterpreter* interpreter = nullptr;
TfLiteTensor* input = nullptr;
TfLiteTensor* output = nullptr;
TfLiteTensor* output_type = nullptr;
TfLiteTensor* output_precip = nullptr;
constexpr int kTensorArenaSize = 100*1024;
// Keep aligned to 16 bytes for CMSIS
alignas(16) uint8_t tensor_arena[kTensorArenaSize];
}  // namespace

// The name of this function is important for Arduino compatibility.
void setup() {
  tflite::InitializeTarget();

  // Map the model into a usable data structure. This doesn't involve any
  // copying or parsing, it's a very lightweight operation.
  model = tflite::GetModel(g_model);
  if (model->version() != TFLITE_SCHEMA_VERSION) {
    MicroPrintf(
        "Model provided is schema version %d not equal "
        "to supported version %d.\n",
        model->version(), TFLITE_SCHEMA_VERSION);
  }

  // This pulls in all the operation implementations we need.
  // NOLINTNEXTLINE(runtime-global-variables)
  static tflite::AllOpsResolver resolver;

  // Build an interpreter to run the model with.
  static tflite::MicroInterpreter static_interpreter(
      model, resolver, tensor_arena, kTensorArenaSize);
  interpreter = &static_interpreter;

  // Allocate memory from the tensor_arena for the model's tensors.
  TfLiteStatus allocate_status = interpreter->AllocateTensors();
  if (allocate_status != kTfLiteOk) {
    MicroPrintf("AllocateTensors() failed");
    return;
  }

  // Obtain a pointer to the model's input tensor
  input = interpreter->input(0);
  input->dims->data[0] = 1;
  input->dims->data[1] = 30;
  input->dims->data[2] = 1;
  input->dims->data[3] = 1;

  MicroPrintf("size:%d data:%d data1:%d data2:%d \n",input->dims->size,input->dims->data[0],input->dims->data[1],input->dims->data[2],input->type);
  Serial.println(input->type);
  


  float input_data[1][30][1] = {
        {
            {0.14},
            {0.95},
            {0.33},
            {0.25},
            {0.29},
            {0.26},
            {0.88},
            {0.78},
            {0.78},
            {0.5},
            {0.59},
            {0.65},
            {0.38},
            {0.27},
            {0.3},
            {0.27},
            {0.5},
            {0.01},
            {0.275},
            {0.333},
            {0.237},
            {0.54},
            {0.91},
            {0.96},
            {0.83},
            {0.023},
            {0.87},
            {0.534},
            {0.32},
            {0.50}
        }
    }; // Put your input data here
  for (int i = 0; i < 30; i++) {
    input->data.f[i] = input_data[0][i][0];
  }

  TfLiteStatus invoke_status = interpreter->Invoke();
  if (invoke_status != kTfLiteOk) {
    MicroPrintf("Invoke failed\n");
  }

  output = interpreter->output(0);
  output_type = interpreter->output(1);
  output_precip = interpreter->output(0);

  MicroPrintf("size:%d data:%d data1:%d type:%c\n",output->dims->size,output->dims->data[0],output->dims->data[1],input->type);

  Serial.println(output_type->type);
  Serial.println(output_precip->type);
  float output_val = output->data.f[0];

  MicroPrintf("Output value: %f\n", output_val);
 
}

void loop() {} According to this [1825](https://github.com/tensorflow/tflite-micro/issues/1825) and [patch](https://github.com/tensorflow/tflite-micro/files/11012191/0001-changes-to-add-to-support-int32-types-for-LSTM.patch)， I have tried to modify the  CMSIS-NN/add.cpp, the error didn't run, but the output values is NaN. 
@tiruk007

 @pjpratik 
Could you please look into this

Thank you! Hi @Fabiran 

I see that you are using TF 2.3. We recommend you to use latest stable version TF 2.11 and also  fusion code lab for Keras LSTM conversion which can be found [here](https://www.tensorflow.org/lite/models/convert/rnn#example).

In your case,

```
run_model = tf.function(lambda x: model(x))
# This is important, let's fix the input size.
BATCH_SIZE = 1
STEPS = window_size
INPUT_SIZE = 1
concrete_func = run_model.get_concrete_function(
    tf.TensorSpec([BATCH_SIZE, STEPS, INPUT_SIZE], model.inputs[0].dtype))

# model directory.
MODEL_DIR = "keras_lstm"
model.save(MODEL_DIR, save_format="tf", signatures=concrete_func)

converter = tf.lite.TFLiteConverter.from_saved_model(MODEL_DIR)
tflite_model = converter.convert()
with open(f"model1.tflite", "wb") as f:
  f.write(tflite_model)
````
Can you please try this and let us know if the issue still persists.

Thanks. > Hi @Fabiran
> 
> I see that you are using TF 2.3. We recommend you to use latest stable version TF 2.11 and also fusion code lab for Keras LSTM conversion which can be found [here](https://www.tensorflow.org/lite/models/convert/rnn#example).
> 
> In your case,
> 
> ```
> run_model = tf.function(lambda x: model(x))
> # This is important, let's fix the input size.
> BATCH_SIZE = 1
> STEPS = window_size
> INPUT_SIZE = 1
> concrete_func = run_model.get_concrete_function(
>     tf.TensorSpec([BATCH_SIZE, STEPS, INPUT_SIZE], model.inputs[0].dtype))
> 
> # model directory.
> MODEL_DIR = "keras_lstm"
> model.save(MODEL_DIR, save_format="tf", signatures=concrete_func)
> 
> converter = tf.lite.TFLiteConverter.from_saved_model(MODEL_DIR)
> tflite_model = converter.convert()
> with open(f"model1.tflite", "wb") as f:
>   f.write(tflite_model)
> ```
> 
> Can you please try this and let us know if the issue still persists.
> 
> Thanks.

Hello, @pjpratik. It is the same issue. tensorflow==2.11 and use get_concrete_function.
![1679676819879](https://user-images.githubusercontent.com/127216064/227590437-f7df8761-be09-4dd8-b182-879a03fd30ee.jpg)

![1679673076818](https://user-images.githubusercontent.com/127216064/227575620-6cea61c7-94a5-49e7-8493-1efca7d44555.jpg)
 Maybe I find a solution, acorrding to this [issue](https://github.com/tensorflow/tflite-micro/issues/1825) and [patch](https://github.com/tensorflow/tflite-micro/files/11012191/0001-changes-to-add-to-support-int32-types-for-LSTM.patch), and take your advice, what' more, I find that the SRAM of arduino nano 33 ble sense is possibly not enough to run the model, so I reduce the LSTM unit and window size, eg: model.add(LSTM(***20***, activation='relu', return_sequences=False, input_shape=(window_size, 1))). And this model needs to be further optimized. Whether this issue has been specifically resolved remains to be considered. Hi @Fabiran Thanks for the information. Is the issue resolved by making those changes?

I have tested the code in python and found no issue while performing inference using `interpretr.invoke` with provided values.The tflite output was aligned to the model's output. Please find the gist [here](https://colab.research.google.com/gist/pjpratik/6292148fc3144b2cdd4ca6d9a1cc1bd7/60055.ipynb).

Thanks. Hi, @pjpratik . It is resolved, thanks for your help! Hi @Fabiran, glad it is resolved.

Please feel free to close the issue.

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/60055">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/60055">No</a>

**System information**
- OS Platform : window10
- TensorFlow installed from (source or binary): pip
- TensorFlow version (or github SHA if from source):2.3.3
- board: Arduino Nano 33 ble sense



I tried to run TensorFlow Lite for Microcontrollers with Arduino Nano 33 ble sense, the model is my custom LSTM. And the result : 
Type INT32 (2) not supported.Node ADD (number 0) failed to invoke with status 1.Node WHILE (number 10) failed to invoke with status 1.Invoke failed. But it has output values.

![model1 tflite](https://user-images.githubusercontent.com/127216064/226529585-4acac340-fb0b-4f24-a3ea-b1a588c41648.png)



