Package 

Class Module

  • All Implemented Interfaces:
    java.io.Closeable , java.lang.AutoCloseable

    
    public class Module
     implements Closeable
                        

    Java wrapper for ExecuTorch Module.

    Warning: These APIs are experimental and subject to change without notice

    • Method Detail

      • forward

         Array<EValue> forward(EValue inputs)

        Runs the 'forward' method of this module with the specified arguments.

        Parameters:
        inputs - arguments for the ExecuTorch module's 'forward' method.
      • execute

         Array<EValue> execute(String methodName, EValue inputs)

        Runs the specified method of this module with the specified arguments.

        Parameters:
        methodName - name of the ExecuTorch method to run.
        inputs - arguments that will be passed to ExecuTorch method.
      • loadMethod

         Unit loadMethod(String methodName)

        Load a method on this module. This might help with the first time inference performance, because otherwise the method is loaded lazily when it's execute. Note: this function is synchronous, and will block until the method is loaded. Therefore, it is recommended to call this on a background thread. However, users need to make sure that they don't execute before this function returns.

      • readLogBuffer

         Array<String> readLogBuffer()

        Retrieve the in-memory log buffer, containing the most recent ExecuTorch log entries.

      • etdump

         Boolean etdump()

        Dump the ExecuTorch ETRecord file to /data/local/tmp/result.etdump.

        Currently for internal (minibench) use only.

      • etdump

         Boolean etdump(String outputPath)

        Dump the ExecuTorch ETDump file to outputPath.

        Parameters:
        outputPath - absolute path to write the etdump file to.
      • destroy

         Unit destroy()

        Explicitly destroys the native Module object. Calling this method is not required, as the native object will be destroyed when this object is garbage-collected. However, the timing of garbage collection is not guaranteed, so proactively calling destroy can free memory more quickly. See com.facebook.jni.HybridData.resetNative.