Enum OnnxJavaType

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<OnnxJavaType>

    public enum OnnxJavaType
    extends java.lang.Enum<OnnxJavaType>
    An enum representing ONNX Runtime supported Java primitive types (and String).
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      BFLOAT16
      A non-IEEE 16-bit floating point value, with 8 exponent bits and 7 mantissa bits.
      BOOL
      A boolean value stored in a single byte.
      DOUBLE
      A 64-bit floating point value.
      FLOAT
      A 32-bit floating point value.
      FLOAT16
      A IEEE 16-bit floating point value.
      INT16
      A 16-bit signed integer value.
      INT32
      A 32-bit signed integer value.
      INT64
      A 64-bit signed integer value.
      INT8
      An 8-bit signed integer value.
      STRING
      A UTF-8 string.
      UINT8
      A 8-bit unsigned integer value.
      UNKNOWN
      An unknown type used as an error condition or a sentinel.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.Class<?> clazz
      The Java side type used as the carrier.
      int size
      The number of bytes used by a single value of this type.
      int value
      The native value of the enum.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static OnnxJavaType mapFromClass​(java.lang.Class<?> clazz)
      Maps from a Java class object into the enum type, returning UNKNOWN for unsupported types.
      static OnnxJavaType mapFromInt​(int value)
      Maps from an int in native land into an OnnxJavaType instance.
      static OnnxJavaType mapFromOnnxTensorType​(TensorInfo.OnnxTensorType onnxValue)
      Maps from the TensorInfo.OnnxTensorType enum to the corresponding OnnxJavaType enum, converting types as appropriate.
      static OnnxJavaType valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static OnnxJavaType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • FLOAT

        public static final OnnxJavaType FLOAT
        A 32-bit floating point value.
      • DOUBLE

        public static final OnnxJavaType DOUBLE
        A 64-bit floating point value.
      • INT8

        public static final OnnxJavaType INT8
        An 8-bit signed integer value.
      • INT16

        public static final OnnxJavaType INT16
        A 16-bit signed integer value.
      • INT32

        public static final OnnxJavaType INT32
        A 32-bit signed integer value.
      • INT64

        public static final OnnxJavaType INT64
        A 64-bit signed integer value.
      • BOOL

        public static final OnnxJavaType BOOL
        A boolean value stored in a single byte.
      • STRING

        public static final OnnxJavaType STRING
        A UTF-8 string.
      • UINT8

        public static final OnnxJavaType UINT8
        A 8-bit unsigned integer value.
      • FLOAT16

        public static final OnnxJavaType FLOAT16
        A IEEE 16-bit floating point value.
      • BFLOAT16

        public static final OnnxJavaType BFLOAT16
        A non-IEEE 16-bit floating point value, with 8 exponent bits and 7 mantissa bits.
      • UNKNOWN

        public static final OnnxJavaType UNKNOWN
        An unknown type used as an error condition or a sentinel.
    • Field Detail

      • value

        public final int value
        The native value of the enum.
      • clazz

        public final java.lang.Class<?> clazz
        The Java side type used as the carrier.
      • size

        public final int size
        The number of bytes used by a single value of this type.
    • Method Detail

      • values

        public static OnnxJavaType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (OnnxJavaType c : OnnxJavaType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static OnnxJavaType valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • mapFromInt

        public static OnnxJavaType mapFromInt​(int value)
        Maps from an int in native land into an OnnxJavaType instance.
        Parameters:
        value - The value to lookup.
        Returns:
        The enum instance.
      • mapFromOnnxTensorType

        public static OnnxJavaType mapFromOnnxTensorType​(TensorInfo.OnnxTensorType onnxValue)
        Maps from the TensorInfo.OnnxTensorType enum to the corresponding OnnxJavaType enum, converting types as appropriate.

        Must match the values from OrtJniUtil.c.

        Parameters:
        onnxValue - The native value type.
        Returns:
        A OnnxJavaType instance representing the Java type
      • mapFromClass

        public static OnnxJavaType mapFromClass​(java.lang.Class<?> clazz)
        Maps from a Java class object into the enum type, returning UNKNOWN for unsupported types.
        Parameters:
        clazz - The class to use.
        Returns:
        An OnnxJavaType instance.