Keras to Tflite using NCHW format

Hello
I have a keras model, trained in channel_first format. I converted the model to tflite, but it adds an additional transpose layer to the tflite model. My target board doesn’t support transpose layer, is there any other way to carry out the conversion. The model has to be trained on channel_first format only.

Hi @Prachi_Mittal ,

Usually, TFLite supports the NHWC(channel_ last) format. As you are using NCHW format, a transpose layer will be added during conversion. Please do change the input format to NHWC before conversion to make tflite compatible to your target hardware.

input = Input(shape=(28,28,3))
input = Conv2D(28, (3, 3), activation ='relu', data_format = 'channel_last')(input)

Thank You