Enum Class DType

java.lang.Object
java.lang.Enum<DType>
ai.beestream.jitnn.DType
All Implemented Interfaces:
Serializable, Comparable<DType>, Constable

public enum DType extends Enum<DType>
Element type of a tensor: FP32 data, INT32 labels and indices, and the half-precision storage types for mixed precision, IEEE FP16 and bfloat16 (the top 16 bits of an FP32), and Q8_0, GGUF's 8-bit blocks (per 32 consecutive values an FP16 scale and 32 signed bytes, 34 bytes), and the OCP 8-bit floats FP8 E4M3 and E5M2, one byte per value, stored without their scale (see Fp8). Q4_0, Q4_1, Q4_K, Q5_K, Q6_K, Q5_0, Q5_1, Q2_K and Q3_K are GGUF's other block formats, stored as their raw blocks (see Gguf).
  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    bfloat16: the top 16 bits of an FP32.
    IEEE 16-bit float.
    IEEE 32-bit float, the default.
    OCP 8-bit float with 4 exponent and 3 mantissa bits, stored without its scale.
    OCP 8-bit float with 5 exponent and 2 mantissa bits, stored without its scale.
    32-bit signed integer, for labels and indices.
    GGUF's 2-bit k-quant super-blocks of 256 values (84 bytes).
    GGUF's 3-bit k-quant super-blocks of 256 values (110 bytes).
    GGUF's 4-bit blocks of 32 values with an FP16 scale (18 bytes).
    GGUF's 4-bit blocks of 32 values with an FP16 scale and minimum (20 bytes).
    GGUF's 4-bit k-quant super-blocks of 256 values (144 bytes).
    GGUF's 5-bit blocks of 32 values with an FP16 scale (22 bytes).
    GGUF's 5-bit blocks of 32 values with an FP16 scale and minimum (24 bytes).
    GGUF's 5-bit k-quant super-blocks of 256 values (176 bytes).
    GGUF's 6-bit k-quant super-blocks of 256 values (210 bytes).
    GGUF's 8-bit blocks: per 32 values an FP16 scale and 32 signed bytes (34 bytes).
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    For GGUF block formats: bytes per block.
    int
    For GGUF block formats: values per block (0 for the other types).
    int
    Bytes per element: 4, 2, or 1 for the 8-bit and block formats (whose blocks blockBytes() sizes).
    boolean
    True for GGUF's block-quantised formats.
    boolean
    True for the floating-point types.
    static DType
    Returns the enum constant of this class with the specified name.
    static DType[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

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

    • F32

      public static final DType F32
      IEEE 32-bit float, the default.
    • I32

      public static final DType I32
      32-bit signed integer, for labels and indices.
    • F16

      public static final DType F16
      IEEE 16-bit float.
    • BF16

      public static final DType BF16
      bfloat16: the top 16 bits of an FP32.
    • Q8_0

      public static final DType Q8_0
      GGUF's 8-bit blocks: per 32 values an FP16 scale and 32 signed bytes (34 bytes).
    • FP8_E4M3

      public static final DType FP8_E4M3
      OCP 8-bit float with 4 exponent and 3 mantissa bits, stored without its scale.
    • FP8_E5M2

      public static final DType FP8_E5M2
      OCP 8-bit float with 5 exponent and 2 mantissa bits, stored without its scale.
    • Q4_0

      public static final DType Q4_0
      GGUF's 4-bit blocks of 32 values with an FP16 scale (18 bytes).
    • Q4_1

      public static final DType Q4_1
      GGUF's 4-bit blocks of 32 values with an FP16 scale and minimum (20 bytes).
    • Q4_K

      public static final DType Q4_K
      GGUF's 4-bit k-quant super-blocks of 256 values (144 bytes).
    • Q5_K

      public static final DType Q5_K
      GGUF's 5-bit k-quant super-blocks of 256 values (176 bytes).
    • Q6_K

      public static final DType Q6_K
      GGUF's 6-bit k-quant super-blocks of 256 values (210 bytes).
    • Q5_0

      public static final DType Q5_0
      GGUF's 5-bit blocks of 32 values with an FP16 scale (22 bytes).
    • Q5_1

      public static final DType Q5_1
      GGUF's 5-bit blocks of 32 values with an FP16 scale and minimum (24 bytes).
    • Q2_K

      public static final DType Q2_K
      GGUF's 2-bit k-quant super-blocks of 256 values (84 bytes).
    • Q3_K

      public static final DType Q3_K
      GGUF's 3-bit k-quant super-blocks of 256 values (110 bytes).
  • Method Details

    • values

      public static DType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • bytes

      public int bytes()
      Bytes per element: 4, 2, or 1 for the 8-bit and block formats (whose blocks blockBytes() sizes).
    • blockValues

      public int blockValues()
      For GGUF block formats: values per block (0 for the other types).
    • blockBytes

      public int blockBytes()
      For GGUF block formats: bytes per block.
    • isBlockQuantized

      public boolean isBlockQuantized()
      True for GGUF's block-quantised formats.
    • isFloat

      public boolean isFloat()
      True for the floating-point types.