في هذا الكود

class MainActivity : AppCompatActivity() {

    private lateinit var imageView: ImageView
    private lateinit var btnImprove: Button

    private lateinit var model: Interpreter

    private val TAG = MainActivity::class.java.simpleName

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        imageView = findViewById(R.id.imageView)
        btnImprove = findViewById(R.id.btn_improve)

        val bitmap = BitmapFactory.decodeResource(this.resources, R.drawable.test)
        imageView.setImageBitmap(bitmap)

        try {
            model = Interpreter(loadModelFile())
        } catch (e: IOException) {
            Log.e(TAG, "Failed to load model", e)
        }

        btnImprove.setOnClickListener {
            improveQuality(bitmap)
        }
    }

    private fun improveQuality(bitmap: Bitmap) {
        val inputBitmap = Bitmap.createScaledBitmap(bitmap, 224, 224, true)
        val input = convertBitmapToByteBuffer(inputBitmap)

        val output = Array(1) { Array(224) { Array(224) { FloatArray(3) } } }

        model.runForMultipleInputsOutputs(arrayOf(input), mapOf(0 to output))

        val outputBitmap = Bitmap.createBitmap(224, 224, Bitmap.Config.ARGB_8888)

        for (i in 0 until 224) {
            for (j in 0 until 224) {
                val pixelValue = output[0][i][j]
                val pixel = -0x1000000 or (pixelValue[0].toInt() shl 16) or (pixelValue[1].toInt() shl 8) or pixelValue[2].toInt()
                outputBitmap.setPixel(i, j, pixel)
            }
        }

        imageView.setImageBitmap(outputBitmap)
    }

    private fun loadModelFile(): MappedByteBuffer {
        val fileDescriptor: AssetFileDescriptor = assets.openFd("lite-model_esrgan-tf2_1.tflite")
        val inputStream: FileInputStream = FileInputStream(fileDescriptor.fileDescriptor)
        val fileChannel: FileChannel = inputStream.channel
        val startOffset: Long = fileDescriptor.startOffset
        val declaredLength: Long = fileDescriptor.declaredLength
        return fileChannel.map(FileChannel.MapMode.READ_ONLY, startOffset, declaredLength)
    }

    private fun convertBitmapToByteBuffer(bitmap: Bitmap): ByteBuffer {
        val inputShape = intArrayOf(1, 224, 224, 3) // Batch size, Height, Width, Depth
        val inputSize = 224 * 224 * 3 * 4 // Multiply by 4 to account for the batch dimension

        val byteBuffer = ByteBuffer.allocateDirect(inputSize)
        byteBuffer.order(ByteOrder.nativeOrder())

        val pixels = IntArray(224 * 224)
        bitmap.getPixels(pixels, 0, bitmap.width, 0, 0, bitmap.width, bitmap.height)

        var pixel = 0
        for (i in 0 until 224) {
            for (j in 0 until 224) {
                val value = pixels[pixel++]

                byteBuffer.putFloat(((value shr 16) and 0xFF) / 255.0f)
                byteBuffer.putFloat(((value shr 8) and 0xFF) / 255.0f)
                byteBuffer.putFloat((value and 0xFF) / 255.0f)
            }
        }

        byteBuffer.rewind()
        return byteBuffer
    }

}

 يحدث خطا

FATAL EXCEPTION: main
                                                                                                    Process: com.dm.myapplication, PID: 11713
                                                                                                    java.lang.IllegalArgumentException: Cannot copy to a TensorFlowLite tensor (input_0) with 30000 bytes from a Java Buffer with 602112 bytes.
                                                                                                    	at org.tensorflow.lite.Tensor.throwIfSrcShapeIsIncompatible(Tensor.java:500)
                                                                                                    	at org.tensorflow.lite.Tensor.setTo(Tensor.java:226)
                                                                                                    	at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:200)
                                                                                                    	at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:344)
                                                                                                    	at com.dm.myapplication.MainActivity.improveQuality(MainActivity.kt:56)
                                                                                                    	at com.dm.myapplication.MainActivity.onCreate$lambda$0(MainActivity.kt:46)
                                                                                                    	at com.dm.myapplication.MainActivity.$r8$lambda$A2vv6RaSUDqdxWrk71BKwGjPy6g(Unknown Source:0)
                                                                                                    	at com.dm.myapplication.MainActivity$$ExternalSyntheticLambda0.onClick(Unknown Source:4)

مع العلم ان هذا هو المكتوب في وثائق النموذج 

Enhanced Super Resolution GAN (Wang et. al.)[1] for image super resolution. Produces x4 Super Resolution Image from images of {Height, Width} >=64. Works best on Bicubically downsampled images.\ (*This is because, the model is originally trained on Bicubically Downsampled DIV2K Dataset*)

NOTE
The image must be a float32 image, converted using tf.cast(image, tf.float32).
The image must be of 4 dimensions, [batch_size, height, width, 3]. To perform super resolution on a single image, use tf.expand_dims(image, 0) to add the batch dimension.
To display the image, don't forget to convert back to uint8 using
tf.cast(tf.clip_by_value(image[index_of_image_to_display], 0, 255), tf.uint8)