Environment

class Environment : JniHandle


Environment to hold configuration options for LiteRT runtime.

Summary

Nested types

Options configurable in LiteRT environment.

Public companion functions

Environment
Environment
@<Error class: unknown class>
create(
    npuAcceleratorProvider: NpuAcceleratorProvider,
    options: Map<Environment.OptionString>
)

Creates an environment with a NpuAcceleratorProvider, which provides the NPU libraries.

Public functions

Set<Accelerator>

Returns the set of accelerators available in the environment.

Protected functions

open Unit

Clean up resources associated with the handle.

Inherited functions

From com.google.ai.edge.litert.JniHandle
Unit

Asserts that the handle is not destroyed, otherwise throws an IllegalStateException.

final Unit

Clean up the handle safely to avoid releasing the same JNI handle multiple times.

Public companion functions

create

@<Error class: unknown class>
fun create(
    npuAcceleratorProvider: NpuAcceleratorProvider,
    options: Map<Environment.OptionString> = mapOf()
): Environment

Creates an environment with a NpuAcceleratorProvider, which provides the NPU libraries.

Parameters
npuAcceleratorProvider: NpuAcceleratorProvider

The NPU accelerator provider.

options: Map<Environment.OptionString> = mapOf()

The options to configure the environment.

Public functions

getAvailableAccelerators

@<Error class: unknown class>
fun getAvailableAccelerators(): Set<Accelerator>

Returns the set of accelerators available in the environment.

Protected functions

destroy

protected open fun destroy(): Unit

Clean up resources associated with the handle.