Class PanamaNnGraphExecutionContext

java.lang.Object
ai.tegmentum.wasmtime4j.panama.wasi.nn.PanamaNnGraphExecutionContext
All Implemented Interfaces:
ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext, AutoCloseable

public final class PanamaNnGraphExecutionContext extends Object implements ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
Panama implementation of the NnGraphExecutionContext interface for WASI-NN inference.

Output tensors are deserialized from the same format as JNI: [num_dims:i32LE][dim0:i32LE]...[dimN:i32LE][tensor_type:i32LE][data bytes].

Since:
1.0.0
  • Method Details

    • getNativeHandle

      public long getNativeHandle()
      Specified by:
      getNativeHandle in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
    • getGraph

      public ai.tegmentum.wasmtime4j.wasi.nn.NnGraph getGraph()
      Specified by:
      getGraph in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
    • compute

      public List<ai.tegmentum.wasmtime4j.wasi.nn.NnTensor> compute(List<ai.tegmentum.wasmtime4j.wasi.nn.NnTensor> inputs) throws ai.tegmentum.wasmtime4j.wasi.nn.NnException
      Specified by:
      compute in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
      Throws:
      ai.tegmentum.wasmtime4j.wasi.nn.NnException
    • computeByIndex

      public List<ai.tegmentum.wasmtime4j.wasi.nn.NnTensor> computeByIndex(ai.tegmentum.wasmtime4j.wasi.nn.NnTensor... inputs) throws ai.tegmentum.wasmtime4j.wasi.nn.NnException
      Specified by:
      computeByIndex in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
      Throws:
      ai.tegmentum.wasmtime4j.wasi.nn.NnException
    • setInput

      public void setInput(int index, ai.tegmentum.wasmtime4j.wasi.nn.NnTensor tensor) throws ai.tegmentum.wasmtime4j.wasi.nn.NnException
      Specified by:
      setInput in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
      Throws:
      ai.tegmentum.wasmtime4j.wasi.nn.NnException
    • setInput

      public void setInput(String name, ai.tegmentum.wasmtime4j.wasi.nn.NnTensor tensor) throws ai.tegmentum.wasmtime4j.wasi.nn.NnException
      Specified by:
      setInput in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
      Throws:
      ai.tegmentum.wasmtime4j.wasi.nn.NnException
    • computeNoInputs

      public List<ai.tegmentum.wasmtime4j.wasi.nn.NnTensor> computeNoInputs() throws ai.tegmentum.wasmtime4j.wasi.nn.NnException
      Specified by:
      computeNoInputs in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
      Throws:
      ai.tegmentum.wasmtime4j.wasi.nn.NnException
    • getOutput

      public ai.tegmentum.wasmtime4j.wasi.nn.NnTensor getOutput(int index) throws ai.tegmentum.wasmtime4j.wasi.nn.NnException
      Specified by:
      getOutput in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
      Throws:
      ai.tegmentum.wasmtime4j.wasi.nn.NnException
    • getOutput

      public ai.tegmentum.wasmtime4j.wasi.nn.NnTensor getOutput(String name) throws ai.tegmentum.wasmtime4j.wasi.nn.NnException
      Specified by:
      getOutput in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
      Throws:
      ai.tegmentum.wasmtime4j.wasi.nn.NnException
    • getInputCount

      public int getInputCount()
      Specified by:
      getInputCount in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
    • getOutputCount

      public int getOutputCount()
      Specified by:
      getOutputCount in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
    • getInputMetadata

      public Map<String,ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext.NnTensorMetadata> getInputMetadata()
      Specified by:
      getInputMetadata in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
    • getOutputMetadata

      public Map<String,ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext.NnTensorMetadata> getOutputMetadata()
      Specified by:
      getOutputMetadata in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
    • isValid

      public boolean isValid()
      Specified by:
      isValid in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface ai.tegmentum.wasmtime4j.wasi.nn.NnGraphExecutionContext