All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bytedeco.tensorflowlite.TfLiteDelegate Maven / Gradle / Ivy

// Targeted by JavaCPP version 1.5.11: DO NOT EDIT THIS FILE

package org.bytedeco.tensorflowlite;

import java.nio.*;
import org.bytedeco.javacpp.*;
import org.bytedeco.javacpp.annotation.*;

import static org.bytedeco.tensorflowlite.global.tensorflowlite.*;


/** WARNING: This is an experimental interface that is subject to change. */
@Properties(inherit = org.bytedeco.tensorflowlite.presets.tensorflowlite.class)
public class TfLiteDelegate extends Pointer {
    static { Loader.load(); }
    /** Default native constructor. */
    public TfLiteDelegate() { super((Pointer)null); allocate(); }
    /** Native array allocator. Access with {@link Pointer#position(long)}. */
    public TfLiteDelegate(long size) { super((Pointer)null); allocateArray(size); }
    /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
    public TfLiteDelegate(Pointer p) { super(p); }
    private native void allocate();
    private native void allocateArray(long size);
    @Override public TfLiteDelegate position(long position) {
        return (TfLiteDelegate)super.position(position);
    }
    @Override public TfLiteDelegate getPointer(long i) {
        return new TfLiteDelegate((Pointer)this).offsetAddress(i);
    }

  /** Data that delegate needs to identify itself. This data is owned by the
   *  delegate. The delegate is owned in the user code, so the delegate is
   *  responsible for deallocating this when it is destroyed. */
  public native Pointer data_(); public native TfLiteDelegate data_(Pointer setter);

  /** Invoked by {@code ModifyGraphWithDelegate}. This prepare is called, giving the
   *  delegate a view of the current graph through {@code TfLiteContext*}. It
   *  typically will look at the nodes and call
   *  {@code ReplaceNodeSubsetsWithDelegateKernels()} to ask the TensorFlow lite
   *  runtime to create macro-nodes to represent delegated subgraphs of the
   *  original graph. */
  public static class Prepare_TfLiteContext_TfLiteDelegate extends FunctionPointer {
      static { Loader.load(); }
      /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
      public    Prepare_TfLiteContext_TfLiteDelegate(Pointer p) { super(p); }
      protected Prepare_TfLiteContext_TfLiteDelegate() { allocate(); }
      private native void allocate();
      public native @Cast("TfLiteStatus") int call(TfLiteContext context,
                            TfLiteDelegate delegate);
  }
  public native Prepare_TfLiteContext_TfLiteDelegate Prepare(); public native TfLiteDelegate Prepare(Prepare_TfLiteContext_TfLiteDelegate setter);

  /** Copy the data from delegate buffer handle into raw memory of the given
   *  {@code tensor}. Note that the delegate is allowed to allocate the raw bytes as
   *  long as it follows the rules for {@code kTfLiteDynamic} tensors, in which case
   *  this cannot be null. */
  public static class CopyFromBufferHandle_TfLiteContext_TfLiteDelegate_int_TfLiteTensor extends FunctionPointer {
      static { Loader.load(); }
      /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
      public    CopyFromBufferHandle_TfLiteContext_TfLiteDelegate_int_TfLiteTensor(Pointer p) { super(p); }
      protected CopyFromBufferHandle_TfLiteContext_TfLiteDelegate_int_TfLiteTensor() { allocate(); }
      private native void allocate();
      public native @Cast("TfLiteStatus") int call(TfLiteContext context,
                                         TfLiteDelegate delegate,
                                         @Cast("TfLiteBufferHandle") int buffer_handle,
                                         TfLiteTensor tensor);
  }
  public native CopyFromBufferHandle_TfLiteContext_TfLiteDelegate_int_TfLiteTensor CopyFromBufferHandle(); public native TfLiteDelegate CopyFromBufferHandle(CopyFromBufferHandle_TfLiteContext_TfLiteDelegate_int_TfLiteTensor setter);

  /** Copy the data from raw memory of the given {@code tensor} to delegate buffer
   *  handle. This can be null if the delegate doesn't use its own buffer. */
  public static class CopyToBufferHandle_TfLiteContext_TfLiteDelegate_int_TfLiteTensor extends FunctionPointer {
      static { Loader.load(); }
      /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
      public    CopyToBufferHandle_TfLiteContext_TfLiteDelegate_int_TfLiteTensor(Pointer p) { super(p); }
      protected CopyToBufferHandle_TfLiteContext_TfLiteDelegate_int_TfLiteTensor() { allocate(); }
      private native void allocate();
      public native @Cast("TfLiteStatus") int call(TfLiteContext context,
                                       TfLiteDelegate delegate,
                                       @Cast("TfLiteBufferHandle") int buffer_handle,
                                       TfLiteTensor tensor);
  }
  public native CopyToBufferHandle_TfLiteContext_TfLiteDelegate_int_TfLiteTensor CopyToBufferHandle(); public native TfLiteDelegate CopyToBufferHandle(CopyToBufferHandle_TfLiteContext_TfLiteDelegate_int_TfLiteTensor setter);

  /** Free the Delegate Buffer Handle. Note: This only frees the handle, but
   *  this doesn't release the underlying resource (e.g. textures). The
   *  resources are either owned by application layer or the delegate.
   *  This can be null if the delegate doesn't use its own buffer. */
  public static class FreeBufferHandle_TfLiteContext_TfLiteDelegate_IntPointer extends FunctionPointer {
      static { Loader.load(); }
      /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
      public    FreeBufferHandle_TfLiteContext_TfLiteDelegate_IntPointer(Pointer p) { super(p); }
      protected FreeBufferHandle_TfLiteContext_TfLiteDelegate_IntPointer() { allocate(); }
      private native void allocate();
      public native void call(TfLiteContext context,
                             TfLiteDelegate delegate,
                             @Cast("TfLiteBufferHandle*") IntPointer handle);
  }
  public native FreeBufferHandle_TfLiteContext_TfLiteDelegate_IntPointer FreeBufferHandle(); public native TfLiteDelegate FreeBufferHandle(FreeBufferHandle_TfLiteContext_TfLiteDelegate_IntPointer setter);

  /** Bitmask flags. See the comments in {@code TfLiteDelegateFlags}. */
  
  ///
  public native @Cast("int64_t") long flags(); public native TfLiteDelegate flags(long setter);

  /** The opaque delegate builder associated with this object.  If set then the
   *  TF Lite runtime will give precedence to this field.  E.g. instead of
   *  invoking {@code Prepare} via the function pointer inside the {@code TfLiteDelegate}
   *  object, the runtime will first check if the corresponding function
   *  pointer inside {@code opaque_delegate_builder} is set and if so invoke that.
   * 
   *  If this field is non-null, then the {@code Prepare} field (of the
   *  {@code TfLiteDelegate}) should be null. */
  public native TfLiteOpaqueDelegateBuilder opaque_delegate_builder(); public native TfLiteDelegate opaque_delegate_builder(TfLiteOpaqueDelegateBuilder setter);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy