Class OnnxModel

java.lang.Object
ai.beestream.jitnn.onnx.OnnxModel

public final class OnnxModel extends Object
An ONNX model as read from its file: the main graph's nodes, initializers, inputs and outputs, and the operator-set versions. Initializers stored outside the model file (ONNX external data) are memory-mapped from their files next to it.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    An attribute of a node; which fields are set depends on its type.
    static final record 
    A graph: its nodes in topological order, the initializers (weights and constants) by name, and its inputs and outputs.
    static final record 
    A node of the graph: an operator application, with the names of its input and output values.
    static final record 
    A tensor stored in the model: dims, element type and its data as little-endian bytes.
    static final record 
    A graph input or output: name, element type and dims (-1 for a symbolic dimension), with the symbolic dimensions' names (dim_param, null where a dimension has none or dims is null).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    ONNX data type: bfloat16.
    static final int
    ONNX data type: boolean, one byte.
    static final int
    ONNX data type: 64-bit float.
    static final int
    ONNX data type: 32-bit float.
    static final int
    ONNX data type: IEEE 16-bit float.
    static final int
    ONNX data type: 16-bit signed integer.
    static final int
    ONNX data type: 32-bit signed integer.
    static final int
    ONNX data type: 64-bit signed integer.
    static final int
    ONNX data type: 8-bit signed integer.
    static final int
    ONNX data type: 16-bit unsigned integer.
    static final int
    ONNX data type: 8-bit unsigned integer.
  • Method Summary

    Modifier and Type
    Method
    Description
    The model's main graph.
    static OnnxModel
    load(Path file)
    Reads an ONNX model file; initializers kept in external data files next to it are memory-mapped.
    static OnnxModel
    of(OnnxModel.Graph graph, Map<String,Long> opsets)
    A model from a graph built in memory (by jitNN's other importers), with its operator-set versions.
    long
    opset(String domain)
    The operator-set version of domain ("" is the default ONNX domain).

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • FLOAT

      public static final int FLOAT
      ONNX data type: 32-bit float.
      See Also:
    • UINT8

      public static final int UINT8
      ONNX data type: 8-bit unsigned integer.
      See Also:
    • INT8

      public static final int INT8
      ONNX data type: 8-bit signed integer.
      See Also:
    • UINT16

      public static final int UINT16
      ONNX data type: 16-bit unsigned integer.
      See Also:
    • INT16

      public static final int INT16
      ONNX data type: 16-bit signed integer.
      See Also:
    • INT32

      public static final int INT32
      ONNX data type: 32-bit signed integer.
      See Also:
    • INT64

      public static final int INT64
      ONNX data type: 64-bit signed integer.
      See Also:
    • BOOL

      public static final int BOOL
      ONNX data type: boolean, one byte.
      See Also:
    • FLOAT16

      public static final int FLOAT16
      ONNX data type: IEEE 16-bit float.
      See Also:
    • DOUBLE

      public static final int DOUBLE
      ONNX data type: 64-bit float.
      See Also:
    • BFLOAT16

      public static final int BFLOAT16
      ONNX data type: bfloat16.
      See Also:
  • Method Details

    • of

      public static OnnxModel of(OnnxModel.Graph graph, Map<String,Long> opsets)
      A model from a graph built in memory (by jitNN's other importers), with its operator-set versions.
    • graph

      public OnnxModel.Graph graph()
      The model's main graph.
    • opset

      public long opset(String domain)
      The operator-set version of domain ("" is the default ONNX domain).
    • load

      public static OnnxModel load(Path file) throws IOException
      Reads an ONNX model file; initializers kept in external data files next to it are memory-mapped.
      Throws:
      IOException