java.lang.IllegalStateException: Internal error: Unexpected failure when preparing tensor allocations: tensorflow/lite/kernels/pad.cc:79 SizeOfDimension(op_context->paddings, 0) != op_context->dims (4 != 1) Node number 0 (PAD) failed to prepare.
@khirmansaleem,
Could you please provide the complete code or the colab gist and the tensorflow version you are using to reproduce the issue which helps us to analyse the issue in an effective way. 

It looks like you have provided the dynamic tensors to the tflite. Could you please try to provide with **batch size = 1** and run the `interpreter` for every image in a loop. If the loaded model in TFLite does not have any defined **batch size**, converter will take the batch size as 1, and when you evaluate it with the different batch size, you are likely to end up with the problem which you are facing.
Thank you! 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. Closing this as stale. Please reopen if this is still a valid request. Thank you! 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/60844">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/60844">No</a>

I have converted my DenseNet-121 model to model.tflite and when i am loading it to android app and trying to make predictions, it's giving following errors :                                                                                                                                                                                  java.lang.IllegalStateException: Internal error: Unexpected failure when preparing tensor allocations: tensorflow/lite/kernels/pad.cc:79 SizeOfDimension(op_context->paddings, 0) != op_context->dims (4 != 1)
Node number 0 (PAD) failed to prepare.
	at org.tensorflow.lite.NativeInterpreterWrapper.allocateTensors(Native Method)
	at org.tensorflow.lite.NativeInterpreterWrapper.allocateTensorsIfNeeded(NativeInterpreterWrapper.java:308)
	at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:248)
	at org.tensorflow.lite.InterpreterImpl.runForMultipleInputsOutputs(InterpreterImpl.java:101)
	at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:77)
	at org.tensorflow.lite.InterpreterImpl.run(InterpreterImpl.java:94)
	at org.tensorflow.lite.Interpreter.run(Interpreter.java:77)
	at com.example.appleleafdiseasedetection.DiseaseDetector$2.onClick(DiseaseDetector.java:72)
	at android.view.View.performClick(View.java:7743)
	at android.view.View.performClickInternal(View.java:7720)
	at android.view.View.access$3700(View.java:854)
	at android.view.View$PerformClick.run(View.java:29111)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:210)
	at android.os.Looper.loop(Looper.java:299)
	at android.app.ActivityThread.main(ActivityThread.java:8309)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038)                                                                                                                how can i solve it?
                                                                                                                                                                         