From 1fc8f6af1d542ed358d12dec88156d4cbf70d9d4 Mon Sep 17 00:00:00 2001 From: pjpratik <118897289+pjpratik@users.noreply.github.com> Date: Fri, 21 Jul 2023 16:07:32 +0530 Subject: [PATCH] Update super_resolution.ipynb to resize the input tensor The input tensor to the interpreter needs to be resized to take `1x50x50x3` image else it is throwing the dimension mismatch error. Thanks. --- lite/examples/super_resolution/ml/super_resolution.ipynb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lite/examples/super_resolution/ml/super_resolution.ipynb b/lite/examples/super_resolution/ml/super_resolution.ipynb index 425b5464363..abeb79e9d8a 100644 --- a/lite/examples/super_resolution/ml/super_resolution.ipynb +++ b/lite/examples/super_resolution/ml/super_resolution.ipynb @@ -200,12 +200,16 @@ "\n", "# Load TFLite model and allocate tensors.\n", "interpreter = tf.lite.Interpreter(model_path=esrgan_model_path)\n", - "interpreter.allocate_tensors()\n", + "\n", "# Get input and output tensors.\n", "input_details = interpreter.get_input_details()\n", "output_details = interpreter.get_output_details()\n", "\n", + "#Resize the input tensor.\n", + "interpreter.resize_tensor_input(input_details[0]['index'],[1,50,50,3])\n", + "interpreter.allocate_tensors()\n", + "\n", "# Run the model\n", "interpreter.set_tensor(input_details[0]['index'], lr)\n", "interpreter.invoke()\n",