LiteRTCompiler

expect class LiteRTCompiler(filePath: String, accelerator: LiteRTAccelerator)

Compiles and executes a LiteRT model.

Call init before using this instance and close when it is no longer needed.

Constructors

Link copied to clipboard
expect constructor(filePath: String, accelerator: LiteRTAccelerator)

Functions

Link copied to clipboard
expect suspend fun close()

Releases all native resources associated with this compiler.

Link copied to clipboard

Returns the buffer requirements for the specified input tensor.

Link copied to clipboard
expect suspend fun getInputBuffers(signatureIndex: Int = 0): List<TFBuffer>

Returns all input buffers allocated for the model.

Link copied to clipboard
expect suspend fun getInputTensorType(inputName: String): LiteRTTensorType

Returns the tensor type information for the specified input tensor.

Link copied to clipboard

Returns the buffer requirements for the specified output tensor.

Link copied to clipboard
expect suspend fun getOutputBuffers(signatureIndex: Int = 0): List<TFBuffer>

Returns all output buffers allocated for the model.

Link copied to clipboard
expect suspend fun getOutputTensorType(outputName: String): LiteRTTensorType

Returns the tensor type information for the specified output tensor.

Link copied to clipboard
expect suspend fun init()

Initializes the model and prepares it for inference.

Link copied to clipboard
expect suspend fun run(inputs: List<TFBuffer>, outputs: List<TFBuffer>, signatureIndex: Int = 0)

Executes inference using the provided input and output buffers.