Sign in

    mizchi/webnn/backend/webnn does not have a README file

    TfliteCpuRunner

    pub struct TfliteCpuRunner {
    runtime :
    TfliteRuntimeModel

    }

    TfliteCpuRunner::compile

    fn TfliteCpuRunner::compile(bytes : Bytes) -> TfliteCpuRunner raise

    Parse a TFLite FlatBuffer for synchronous CPU execution.

    This runner shares the same TFLite I/O validation and quantization boundary as TfliteRunner, but keeps execution independent of WebNN availability.

    TfliteCpuRunner::run

    Run a parsed TFLite model through the CPU backend.

    TfliteCpuRunnerCache

    pub struct TfliteCpuRunnerCache {
    entries : Map[String, TfliteCpuRunner]
    entry_bytes : Map[String, Int]
    last_access : Map[String, Int]
    capacity_ : Int
    byte_capacity_ : Int
    resident_bytes_ : Int
    access_counter : Int
    hits_ : Int
    misses_ : Int
    evictions_ : Int
    }

    TfliteCpuRunnerCache::byte_capacity

    fn TfliteCpuRunnerCache::byte_capacity(self : TfliteCpuRunnerCache) -> Int

    TfliteCpuRunnerCache::capacity

    fn TfliteCpuRunnerCache::capacity(self : TfliteCpuRunnerCache) -> Int

    TfliteCpuRunnerCache::clear

    Release parsed CPU models while retaining lifetime hit/miss/eviction counters.

    TfliteCpuRunnerCache::length

    fn TfliteCpuRunnerCache::length(self : TfliteCpuRunnerCache) -> Int

    TfliteCpuRunnerCache::metrics

    TfliteCpuRunnerCache::new

    Create a CPU runner cache for at most 32 parsed models and 64 MiB of source FlatBuffers. It is intended for WebNNRuntime's CPU fallback path.

    TfliteCpuRunnerCache::new_with_capacity

    Construct a CPU cache with a model-count limit and the default 64 MiB source-FlatBuffer budget.

    TfliteCpuRunnerCache::new_with_limits

    fn TfliteCpuRunnerCache::new_with_limits(capacity : Int, byte_capacity : Int) -> TfliteCpuRunnerCache raise
    TensorError

    Construct a parsed-CPU-model cache bounded by entry count and source bytes.

    TfliteCpuRunnerCache::resident_bytes

    fn TfliteCpuRunnerCache::resident_bytes(self : TfliteCpuRunnerCache) -> Int

    TfliteCpuRunnerCache::run

    async fn TfliteCpuRunnerCache::run(self : TfliteCpuRunnerCache, bytes : Bytes, input_values : Array[TfliteRunnerInput]) -> Array[TfliteRunnerOutput]

    Parse and run bytes through the CPU cache. The SHA-256 digest is computed for this call; use run_artifact to reuse a digest prepared by the caller.

    TfliteCpuRunnerCache::run_artifact

    fn TfliteCpuRunnerCache::run_artifact(self : TfliteCpuRunnerCache, artifact : TfliteModelArtifact, input_values : Array[TfliteRunnerInput]) -> Array[TfliteRunnerOutput] raise

    Run a pre-hashed artifact through the parsed CPU-model cache.

    TfliteCpuRunnerCacheMetrics

    pub struct TfliteCpuRunnerCacheMetrics {
    hits_ : Int
    misses_ : Int
    evictions_ : Int
    entries_ : Int
    resident_bytes_ : Int
    byte_capacity_ : Int
    }

    TfliteCpuRunnerCacheMetrics::byte_capacity

    TfliteCpuRunnerCacheMetrics::entries

    TfliteCpuRunnerCacheMetrics::evictions

    TfliteCpuRunnerCacheMetrics::hits

    TfliteCpuRunnerCacheMetrics::misses

    TfliteCpuRunnerCacheMetrics::resident_bytes

    TfliteModelArtifact

    pub struct TfliteModelArtifact {
    bytes_ : Bytes
    digest_ : String
    }

    Immutable TFLite bytes with a SHA-256 digest computed once.

    Construct this artifact once when a model is loaded, then pass it to WebNNRuntime::run_prepared_tflite to avoid re-hashing large FlatBuffers on every cache lookup.

    TfliteModelArtifact::byte_length

    fn TfliteModelArtifact::byte_length(self : TfliteModelArtifact) -> Int

    TfliteModelArtifact::digest

    fn TfliteModelArtifact::digest(self : TfliteModelArtifact) -> String

    TfliteModelArtifact::from_bytes

    async fn TfliteModelArtifact::from_bytes(bytes : Bytes) -> TfliteModelArtifact

    TfliteRunner

    TfliteRunner::compile

    Compile an arbitrary TFLite FlatBuffer for one sequential execution slot.

    TfliteRunner::compile_pool

    async fn TfliteRunner::compile_pool(bytes : Bytes, preference :
    DevicePreference
    , execution_pool_size : Int) -> TfliteRunner

    Compile an arbitrary TFLite FlatBuffer with independently prepared slots.

    The returned runner owns its program and must be destroyed by its owner.

    TfliteRunner::destroy

    fn TfliteRunner::destroy(self : TfliteRunner) -> Unit

    TfliteRunner::pool_size

    fn TfliteRunner::pool_size(self : TfliteRunner) -> Int

    TfliteRunner::run

    async fn TfliteRunner::run(self : TfliteRunner, input_values : Array[TfliteRunnerInput]) -> Array[TfliteRunnerOutput]

    Run named float32 or raw quantized inputs and return named TFLite outputs.

    TfliteRunnerCache

    pub struct TfliteRunnerCache {
    entries : Map[String, TfliteRunner]
    entry_bytes : Map[String, Int]
    last_access : Map[String, Int]
    capacity_ : Int
    byte_capacity_ : Int
    generation :
    Ref
    [Int]
    resident_bytes_ : Int
    access_counter : Int
    hits_ : Int
    misses_ : Int
    evictions_ : Int
    }

    TfliteRunnerCache::byte_capacity

    fn TfliteRunnerCache::byte_capacity(self : TfliteRunnerCache) -> Int

    TfliteRunnerCache::capacity

    fn TfliteRunnerCache::capacity(self : TfliteRunnerCache) -> Int

    TfliteRunnerCache::clear

    fn TfliteRunnerCache::clear(self : TfliteRunnerCache) -> Int

    Clear all retained WebNN programs and prevent an already compiling runner from being reinserted after this call returns.

    TfliteRunnerCache::length

    fn TfliteRunnerCache::length(self : TfliteRunnerCache) -> Int

    TfliteRunnerCache::metrics

    Return lifetime cache counters. clear() releases programs but retains these counters so callers can observe invalidation and eviction behavior.

    TfliteRunnerCache::new

    Create a cache for at most 32 models and 64 MiB of source FlatBuffers.

    The byte budget is deliberately based on model bytes: WebNN does not expose a portable measurement for compiled resource memory.

    TfliteRunnerCache::new_with_capacity

    Construct a cache with a model-count limit and the default 64 MiB budget.

    TfliteRunnerCache::new_with_limits

    fn TfliteRunnerCache::new_with_limits(capacity : Int, byte_capacity : Int) -> TfliteRunnerCache raise
    TensorError

    Construct a cache bounded by both entry count and source FlatBuffer bytes.

    A model larger than byte_capacity is compiled and run transiently rather than evicting the entire cache only to exceed its budget.

    TfliteRunnerCache::resident_bytes

    fn TfliteRunnerCache::resident_bytes(self : TfliteRunnerCache) -> Int

    TfliteRunnerCache::run

    Run a model through a cache owned by self.

    The SHA-256 digest covers the original FlatBuffer bytes; device preference and slot count are part of the canonical cache key.

    TfliteRunnerCache::run_artifact

    TfliteRunnerCache::run_artifact_pool

    async fn TfliteRunnerCache::run_artifact_pool(self : TfliteRunnerCache, artifact : TfliteModelArtifact, preference :
    DevicePreference
    , execution_pool_size : Int, input_values : Array[TfliteRunnerInput]) -> Array[TfliteRunnerOutput]

    TfliteRunnerCache::run_artifact_pool_with_compiler

    async fn TfliteRunnerCache::run_artifact_pool_with_compiler(self : TfliteRunnerCache, artifact : TfliteModelArtifact, preference :
    DevicePreference
    , execution_pool_size : Int, input_values : Array[TfliteRunnerInput], compile : () ->
    Promise
    [TfliteRunner]) -> Array[TfliteRunnerOutput]

    Run an artifact with an instrumented compiler while preserving cache ownership and invalidation semantics.

    This advanced entry point is useful for compile tracing or externally scheduled compilation. compile must return a runner for artifact, preference, and execution_pool_size; it is evaluated only on a miss.

    TfliteRunnerCache::run_pool

    async fn TfliteRunnerCache::run_pool(self : TfliteRunnerCache, bytes : Bytes, preference :
    DevicePreference
    , execution_pool_size : Int, input_values : Array[TfliteRunnerInput]) -> Array[TfliteRunnerOutput]

    TfliteRunnerCacheKey

    pub struct TfliteRunnerCacheKey {
    model_digest_ : String
    device_ :
    DevicePreference

    execution_pool_size_ : Int
    }

    TfliteRunnerCacheKey::canonical

    fn TfliteRunnerCacheKey::canonical(self : TfliteRunnerCacheKey) -> String

    TfliteRunnerCacheKey::new

    TfliteRunnerCacheMetrics

    pub struct TfliteRunnerCacheMetrics {
    hits_ : Int
    misses_ : Int
    evictions_ : Int
    entries_ : Int
    resident_bytes_ : Int
    byte_capacity_ : Int
    }

    TfliteRunnerCacheMetrics::byte_capacity

    fn TfliteRunnerCacheMetrics::byte_capacity(self : TfliteRunnerCacheMetrics) -> Int

    TfliteRunnerCacheMetrics::entries

    TfliteRunnerCacheMetrics::evictions

    TfliteRunnerCacheMetrics::hits

    TfliteRunnerCacheMetrics::misses

    TfliteRunnerCacheMetrics::resident_bytes

    fn TfliteRunnerCacheMetrics::resident_bytes(self : TfliteRunnerCacheMetrics) -> Int

    TfliteRunnerInput

    pub struct TfliteRunnerInput {
    name_ : String
    values_ : TfliteRunnerValues
    }

    TfliteRunnerInput::float32

    fn TfliteRunnerInput::float32(name : String, values : Array[Float]) -> TfliteRunnerInput raise
    TensorError

    TfliteRunnerInput::name

    fn TfliteRunnerInput::name(self : TfliteRunnerInput) -> String

    TfliteRunnerInput::quantized

    fn TfliteRunnerInput::quantized(name : String, values : Array[Int]) -> TfliteRunnerInput raise
    TensorError

    TfliteRunnerInput::values

    TfliteRunnerOutput

    pub struct TfliteRunnerOutput {
    name_ : String
    values_ : TfliteRunnerValues
    }

    TfliteRunnerOutput::name

    fn TfliteRunnerOutput::name(self : TfliteRunnerOutput) -> String

    TfliteRunnerOutput::values

    TfliteRunnerValues

    pub enum TfliteRunnerValues {
    Float32(Array[Float])
    Quantized(Array[Int])
    }

    Runtime values accepted by and returned from TfliteRunner.

    The WebNN graph always uses float32 internally. Quantized keeps the caller-facing UINT8/INT8 representation at the TFLite boundary.

    WebNNCapabilities

    pub struct WebNNCapabilities {
    contract_ : WebNNContextContract
    preference_ :
    DevicePreference

    preferred_input_layout_ :
    InputLayout

    op_support_limits_available_ : Bool
    tensor_io_available_ : Bool
    supported_operators_ : Array[String]
    }

    WebNNCapabilities::contract

    WebNNCapabilities::op_support_limits_available

    fn WebNNCapabilities::op_support_limits_available(self : WebNNCapabilities) -> Bool

    WebNNCapabilities::preferred_input_layout

    WebNNCapabilities::supported_operators

    fn WebNNCapabilities::supported_operators(self : WebNNCapabilities) -> Array[String]

    WebNNCapabilities::tensor_io_available

    fn WebNNCapabilities::tensor_io_available(self : WebNNCapabilities) -> Bool

    WebNNContextContract

    pub enum WebNNContextContract {
    Accelerated
    LegacyDeviceType
    } derive(Eq,
    Debug
    )

    WebNNContextContract::to_string

    fn WebNNContextContract::to_string(self : WebNNContextContract) -> String

    WebNNExecution

    WebNNExecution::destroy

    fn WebNNExecution::destroy(self : WebNNExecution) -> Unit

    WebNNExecution::run

    async fn WebNNExecution::run(self : WebNNExecution, input_values : Array[Float]) -> Array[Float]

    WebNNExecution::run_named

    async fn WebNNExecution::run_named(self : WebNNExecution, input_values : Array[WebNNNamedValues]) -> Array[WebNNNamedValues]

    WebNNGraphBuilder

    pub struct WebNNGraphBuilder {
    context :
    MLContext

    builder :
    MLGraphBuilder

    supported_operators_ : Array[String]
    }

    WebNNGraphBuilder::compile_litert_program

    The returned program owns self; callers must not destroy the builder.

    WebNNGraphBuilder::compile_litert_program_pool

    async fn WebNNGraphBuilder::compile_litert_program_pool(self : WebNNGraphBuilder, model :
    LiteRtModel
    , pool_size : Int) -> WebNNProgram

    The returned program owns self; a lowering or output-binding failure destroys it.

    WebNNGraphBuilder::compile_named

    async fn WebNNGraphBuilder::compile_named(self : WebNNGraphBuilder, inputs : Array[WebNNInput], outputs : Array[WebNNOutput]) -> WebNNSession

    WebNNGraphBuilder::compile_program_named

    async fn WebNNGraphBuilder::compile_program_named(self : WebNNGraphBuilder, inputs : Array[WebNNInput], outputs : Array[WebNNOutput]) -> WebNNProgram

    WebNNGraphBuilder::compile_program_pool_named

    async fn WebNNGraphBuilder::compile_program_pool_named(self : WebNNGraphBuilder, inputs : Array[WebNNInput], outputs : Array[WebNNOutput], pool_size : Int) -> WebNNProgram

    On success the returned program owns self.

    WebNNGraphBuilder::compile_program_pool_single

    async fn WebNNGraphBuilder::compile_program_pool_single(self : WebNNGraphBuilder, input : WebNNInput, output_name : String, output : WebNNTensor, pool_size : Int) -> WebNNProgram

    On success the returned program owns self.

    WebNNGraphBuilder::compile_program_single

    async fn WebNNGraphBuilder::compile_program_single(self : WebNNGraphBuilder, input : WebNNInput, output_name : String, output : WebNNTensor) -> WebNNProgram

    returned program owns self; callers must not destroy the builder.

    WebNNGraphBuilder::compile_single

    async fn WebNNGraphBuilder::compile_single(self : WebNNGraphBuilder, input : WebNNInput, output_name : String, output : WebNNTensor) -> WebNNSession

    WebNNGraphBuilder::constant

    WebNNGraphBuilder::destroy

    fn WebNNGraphBuilder::destroy(self : WebNNGraphBuilder) -> Unit

    WebNNGraphBuilder::lower_litert

    WebNNGraphBuilder::output

    WebNNGraphBuilder::preferred_input_layout

    WebNNGraphBuilder::supported_operators

    fn WebNNGraphBuilder::supported_operators(self : WebNNGraphBuilder) -> Array[String]

    WebNNInput

    pub struct WebNNInput {
    name_ : String
    tensor_ : WebNNTensor
    }

    WebNNInput::tensor

    fn WebNNInput::tensor(self : WebNNInput) -> WebNNTensor

    WebNNLoweredLiteRtGraph

    pub struct WebNNLoweredLiteRtGraph {
    inputs_ : Array[WebNNInput]
    outputs_ : Array[
    LiteRtLoweredValue
    [WebNNTensor]]
    }

    WebNNNamedValues

    pub struct WebNNNamedValues {
    name_ : String
    values_ : Array[Float]
    }

    WebNNNamedValues::name

    fn WebNNNamedValues::name(self : WebNNNamedValues) -> String

    WebNNNamedValues::new

    WebNNNamedValues::values

    fn WebNNNamedValues::values(self : WebNNNamedValues) -> Array[Float]

    WebNNOutput

    pub struct WebNNOutput {
    name_ : String
    tensor_ : WebNNTensor
    }

    WebNNProgram

    pub struct WebNNProgram {
    owner : WebNNGraphBuilder
    executions : Array[WebNNExecution]
    scheduler : WebNNProgramScheduler
    }

    WebNNProgram::destroy

    fn WebNNProgram::destroy(self : WebNNProgram) -> Unit

    WebNNProgram::maximum_concurrency

    fn WebNNProgram::maximum_concurrency(self : WebNNProgram) -> Int

    WebNNProgram::pool_size

    fn WebNNProgram::pool_size(self : WebNNProgram) -> Int

    WebNNProgram::run

    async fn WebNNProgram::run(self : WebNNProgram, input_values : Array[Float]) -> Array[Float]

    WebNNProgram::run_named

    async fn WebNNProgram::run_named(self : WebNNProgram, input_values : Array[WebNNNamedValues]) -> Array[WebNNNamedValues]

    WebNNProgramCache

    pub struct WebNNProgramCache {
    entries : Map[String, WebNNProgram]
    generation :
    Ref
    [Int]
    }

    WebNNProgramCache::clear

    fn WebNNProgramCache::clear(self : WebNNProgramCache) -> Int

    WebNNProgramCache::length

    fn WebNNProgramCache::length(self : WebNNProgramCache) -> Int

    WebNNProgramCache::new

    WebNNProgramCache::run_named_or_compile

    async fn WebNNProgramCache::run_named_or_compile(self : WebNNProgramCache, key : WebNNProgramCacheKey, input_values : Array[WebNNNamedValues], compile : () ->
    Promise
    [WebNNProgram]) -> (Array[WebNNNamedValues], Bool)

    Run a named-I/O program through this cache.

    As with run_or_compile(), this cache owns the compiled program and clear() is the sole public way to release its WebNN resources.

    WebNNProgramCache::run_or_compile

    async fn WebNNProgramCache::run_or_compile(self : WebNNProgramCache, key : WebNNProgramCacheKey, input_values : Array[Float], compile : () ->
    Promise
    [WebNNProgram]) -> (Array[Float], Bool)

    Run a single-input/single-output program through this cache.

    The callback is evaluated only on a cache miss. The program it returns is retained and destroyed by this cache; callers receive only inference data and whether the program was already cached.

    WebNNProgramCacheKey

    pub struct WebNNProgramCacheKey {
    graph_hash_ : String
    device_ :
    DevicePreference

    input_shapes_ : Array[
    Shape
    ]
    execution_pool_size_ : Int
    }

    WebNNProgramCacheKey::canonical

    fn WebNNProgramCacheKey::canonical(self : WebNNProgramCacheKey) -> String

    WebNNProgramCacheKey::new_with_pool

    WebNNProgramScheduler

    type WebNNProgramScheduler

    WebNNRuntime

    pub struct WebNNRuntime {
    preference_ :
    DevicePreference

    execution_pool_size_ : Int
    fallback_ : WebNNRuntimeFallback
    tflite_cache : TfliteRunnerCache
    cpu_tflite_cache : TfliteCpuRunnerCache
    cpu_fallbacks_ : Int
    }

    High-level, cache-owning entry point for executing TFLite models with WebNN.

    A runtime fixes the device preference and execution-pool size for its lifetime. It retains compiled programs internally, so users need only call clear() when the runtime is no longer needed.

    WebNNRuntime::cache_byte_capacity

    fn WebNNRuntime::cache_byte_capacity(self : WebNNRuntime) -> Int

    WebNNRuntime::cache_capacity

    fn WebNNRuntime::cache_capacity(self : WebNNRuntime) -> Int

    WebNNRuntime::cache_resident_bytes

    fn WebNNRuntime::cache_resident_bytes(self : WebNNRuntime) -> Int

    WebNNRuntime::cache_size

    fn WebNNRuntime::cache_size(self : WebNNRuntime) -> Int

    WebNNRuntime::clear

    fn WebNNRuntime::clear(self : WebNNRuntime) -> Int

    Clear cached WebNN programs and parsed CPU fallback models. The return value remains the number of WebNN programs removed for compatibility.

    WebNNRuntime::cpu_cache_byte_capacity

    fn WebNNRuntime::cpu_cache_byte_capacity(self : WebNNRuntime) -> Int

    WebNNRuntime::cpu_cache_capacity

    fn WebNNRuntime::cpu_cache_capacity(self : WebNNRuntime) -> Int

    WebNNRuntime::cpu_cache_resident_bytes

    fn WebNNRuntime::cpu_cache_resident_bytes(self : WebNNRuntime) -> Int

    WebNNRuntime::cpu_cache_size

    fn WebNNRuntime::cpu_cache_size(self : WebNNRuntime) -> Int

    WebNNRuntime::execution_pool_size

    fn WebNNRuntime::execution_pool_size(self : WebNNRuntime) -> Int

    WebNNRuntime::fallback

    WebNNRuntime::metrics

    WebNNRuntime::new_with_cache_limits

    fn WebNNRuntime::new_with_cache_limits(preference :
    DevicePreference
    , execution_pool_size : Int, cache_capacity : Int, cache_byte_capacity : Int, cpu_cache_capacity : Int, cpu_cache_byte_capacity : Int, fallback : WebNNRuntimeFallback) -> WebNNRuntime raise
    TensorError

    Construct a runtime with independent WebNN-program and parsed-CPU-model cache budgets. Both byte limits measure source TFLite FlatBuffer bytes.

    WebNNRuntime::new_with_cpu_fallback

    fn WebNNRuntime::new_with_cpu_fallback(preference :
    DevicePreference
    , execution_pool_size : Int, cache_capacity : Int) -> WebNNRuntime raise
    TensorError

    Construct a bounded runtime that retries failed WebNN work on the CPU.

    WebNNRuntime::new_with_options

    fn WebNNRuntime::new_with_options(preference :
    DevicePreference
    , execution_pool_size : Int, cache_capacity : Int, fallback : WebNNRuntimeFallback) -> WebNNRuntime raise
    TensorError

    WebNNRuntime::new_with_pool

    WebNNRuntime::run_prepared_tflite

    async fn WebNNRuntime::run_prepared_tflite(self : WebNNRuntime, artifact : TfliteModelArtifact, input_values : Array[TfliteRunnerInput]) -> Array[TfliteRunnerOutput]

    Execute a model whose bytes and SHA-256 key were prepared once up front.

    This preserves the TFLite I/O contract of run_tflite while avoiding a repeated digest over the original FlatBuffer on cache hits.

    WebNNRuntime::run_tflite

    async fn WebNNRuntime::run_tflite(self : WebNNRuntime, bytes : Bytes, input_values : Array[TfliteRunnerInput]) -> Array[TfliteRunnerOutput]

    Execute arbitrary TFLite FlatBuffer bytes.

    Models are keyed by their SHA-256 digest, fixed device preference, and fixed execution-pool size. The runtime owns every compiled program.

    WebNNRuntimeFallback

    pub(all) enum WebNNRuntimeFallback {
    Disabled
    Cpu
    }

    WebNNRuntimeMetrics

    pub struct WebNNRuntimeMetrics {
    cache_ : TfliteRunnerCacheMetrics
    cpu_cache_ : TfliteCpuRunnerCacheMetrics
    cpu_fallbacks_ : Int
    }

    WebNNRuntimeMetrics::byte_capacity

    fn WebNNRuntimeMetrics::byte_capacity(self : WebNNRuntimeMetrics) -> Int

    WebNNRuntimeMetrics::cpu_cache_byte_capacity

    fn WebNNRuntimeMetrics::cpu_cache_byte_capacity(self : WebNNRuntimeMetrics) -> Int

    WebNNRuntimeMetrics::cpu_cache_entries

    fn WebNNRuntimeMetrics::cpu_cache_entries(self : WebNNRuntimeMetrics) -> Int

    WebNNRuntimeMetrics::cpu_cache_evictions

    fn WebNNRuntimeMetrics::cpu_cache_evictions(self : WebNNRuntimeMetrics) -> Int

    WebNNRuntimeMetrics::cpu_cache_hits

    fn WebNNRuntimeMetrics::cpu_cache_hits(self : WebNNRuntimeMetrics) -> Int

    WebNNRuntimeMetrics::cpu_cache_misses

    fn WebNNRuntimeMetrics::cpu_cache_misses(self : WebNNRuntimeMetrics) -> Int

    WebNNRuntimeMetrics::cpu_cache_resident_bytes

    fn WebNNRuntimeMetrics::cpu_cache_resident_bytes(self : WebNNRuntimeMetrics) -> Int

    WebNNRuntimeMetrics::cpu_fallbacks

    fn WebNNRuntimeMetrics::cpu_fallbacks(self : WebNNRuntimeMetrics) -> Int

    WebNNRuntimeMetrics::entries

    fn WebNNRuntimeMetrics::entries(self : WebNNRuntimeMetrics) -> Int

    WebNNRuntimeMetrics::evictions

    fn WebNNRuntimeMetrics::evictions(self : WebNNRuntimeMetrics) -> Int

    WebNNRuntimeMetrics::hits

    WebNNRuntimeMetrics::misses

    fn WebNNRuntimeMetrics::misses(self : WebNNRuntimeMetrics) -> Int

    WebNNRuntimeMetrics::resident_bytes

    fn WebNNRuntimeMetrics::resident_bytes(self : WebNNRuntimeMetrics) -> Int

    WebNNSession

    pub struct WebNNSession {
    context :
    MLContext

    graph :
    MLGraph

    input_specs : Array[WebNNValueSpec]
    output_specs : Array[WebNNValueSpec]
    }

    WebNNSession::prepare

    async fn WebNNSession::prepare(self : WebNNSession) -> WebNNExecution

    WebNNSession::run

    async fn WebNNSession::run(self : WebNNSession, input_values : Array[Float]) -> Array[Float]

    WebNNSession::run_named

    async fn WebNNSession::run_named(self : WebNNSession, input_values : Array[WebNNNamedValues]) -> Array[WebNNNamedValues]

    WebNNTensor

    pub struct WebNNTensor {
    builder :
    MLGraphBuilder

    operand :
    MLOperand

    shape_ :
    Shape

    supported_operators : Array[String]
    }

    WebNNValueSpec

    type WebNNValueSpec

    backend_operators

    fn backend_operators() -> Array[String]

    probe_capabilities

    Probe the browser context contract required by this backend.

    The result reports only capabilities used by the library: the context selection contract, opSupportLimits(), prepared tensor I/O, the preferred input layout, and the operators returned for backend_operators().