Enum Class ScalarType

java.lang.Object
java.lang.Enum<ScalarType>
smile.deep.tensor.ScalarType
All Implemented Interfaces:
Serializable, Comparable<ScalarType>, Constable

public enum ScalarType extends Enum<ScalarType>
The data type of the elements stored in the tensor. The enum constants map to the ST_DType codes exposed by the smile_torch native API, which in turn mirror torch::ScalarType.
  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The bfloat16 (brain floating point) floating-point format occupies 16 bits.
    Uninterpreted 16-bit values.
    Uninterpreted 1-bit values, packed into standard 8-bit bytes.
    Uninterpreted 2-bit values, packed into standard 8-bit bytes.
    Uninterpreted 4-bit values, packed into standard 8-bit bytes.
    Uninterpreted 8-bit values.
    Boolean data type.
    Double-precision floating-point complex number.
    Single-precision floating-point complex number.
    Half-precision floating-point complex number.
    Double-precision floating-point number.
    Single-precision floating-point number.
    8-bit floating point, S-E-M 1-4-3.
    8-bit floating point, S-E-M 1-4-3.
    8-bit floating point, S-E-M 1-5-2.
    8-bit floating point, S-E-M 1-5-2.
    Half-precision floating-point number.
    16-bit signed integer.
    32-bit signed integer.
    64-bit signed integer.
    8-bit signed integer.
    32-bit quantized signed tensor type which represents a compressed floating point tensor.
    8-bit quantized signed tensor type which represents a compressed floating point tensor.
    2-bit unsigned quantized integer, packed into standard 8-bit bytes.
    4-bit unsigned quantized integer, packed into standard 8-bit bytes.
    8-bit quantized unsigned tensor type which represents a compressed floating point tensor.
    16-bit unsigned integer.
    32-bit unsigned integer.
    64-bit unsigned integer.
    8-bit unsigned integer (maps to PyTorch torch.uint8 / torch.Byte).
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the native ST_DType code.
    static ScalarType
    Returns the enum constant of this class with the specified name.
    static ScalarType[]
    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

    • UInt8

      public static final ScalarType UInt8
      8-bit unsigned integer (maps to PyTorch torch.uint8 / torch.Byte). Note: PyTorch uses Byte for the unsigned 8-bit type, so Java byte values are interpreted in the range [0, 255] when converting to/from this type.
    • Int8

      public static final ScalarType Int8
      8-bit signed integer.
    • Int16

      public static final ScalarType Int16
      16-bit signed integer.
    • Int32

      public static final ScalarType Int32
      32-bit signed integer.
    • Int64

      public static final ScalarType Int64
      64-bit signed integer.
    • Half

      public static final ScalarType Half
      Half-precision floating-point number. It contains 5 exponent bits and 11 11-bit precision (10 explicitly stored).
    • Float

      public static final ScalarType Float
      Single-precision floating-point number.
    • Double

      public static final ScalarType Double
      Double-precision floating-point number.
    • ComplexHalf

      public static final ScalarType ComplexHalf
      Half-precision floating-point complex number.
    • ComplexFloat

      public static final ScalarType ComplexFloat
      Single-precision floating-point complex number.
    • ComplexDouble

      public static final ScalarType ComplexDouble
      Double-precision floating-point complex number.
    • Bool

      public static final ScalarType Bool
      Boolean data type.
    • QUInt8

      public static final ScalarType QUInt8
      8-bit quantized unsigned tensor type which represents a compressed floating point tensor.
    • QInt8

      public static final ScalarType QInt8
      8-bit quantized signed tensor type which represents a compressed floating point tensor.
    • QInt32

      public static final ScalarType QInt32
      32-bit quantized signed tensor type which represents a compressed floating point tensor.
    • BFloat16

      public static final ScalarType BFloat16
      The bfloat16 (brain floating point) floating-point format occupies 16 bits. This format is a shortened version of the 32-bit IEEE 754 single-precision floating-point format. It preserves the approximate dynamic range of 32-bit floating-point numbers by retaining 8 exponent bits, but supports only an 8-bit precision rather than the 24-bit significand of the single precision.
    • QUInt4x2

      public static final ScalarType QUInt4x2
      4-bit unsigned quantized integer, packed into standard 8-bit bytes.
    • QUInt2x4

      public static final ScalarType QUInt2x4
      2-bit unsigned quantized integer, packed into standard 8-bit bytes.
    • Bits1x8

      public static final ScalarType Bits1x8
      Uninterpreted 1-bit values, packed into standard 8-bit bytes.
    • Bits2x4

      public static final ScalarType Bits2x4
      Uninterpreted 2-bit values, packed into standard 8-bit bytes.
    • Bits4x2

      public static final ScalarType Bits4x2
      Uninterpreted 4-bit values, packed into standard 8-bit bytes.
    • Bits8

      public static final ScalarType Bits8
      Uninterpreted 8-bit values.
    • Bits16

      public static final ScalarType Bits16
      Uninterpreted 16-bit values.
    • Float8e5m2

      public static final ScalarType Float8e5m2
      8-bit floating point, S-E-M 1-5-2.
    • Float8e4m3fn

      public static final ScalarType Float8e4m3fn
      8-bit floating point, S-E-M 1-4-3.

      F (Finite): The format only supports finite numbers and does not support positive or negative infinity (Inf). If a mathematical operation overflows, it results in a NaN rather than infinity.

      N (NaN): It has a special encoding for NaN (Not a Number).

    • Float8e5m2fnuz

      public static final ScalarType Float8e5m2fnuz
      8-bit floating point, S-E-M 1-5-2.

      F (Finite): The format only supports finite numbers and does not support positive or negative infinity (Inf). If a mathematical operation overflows, it results in a NaN rather than infinity.

      N (NaN): It has a special encoding for NaN (Not a Number).

      UZ (Unsigned Zero): It only supports an unsigned zero.

    • Float8e4m3fnuz

      public static final ScalarType Float8e4m3fnuz
      8-bit floating point, S-E-M 1-4-3.

      F (Finite): The format only supports finite numbers and does not support positive or negative infinity (Inf). If a mathematical operation overflows, it results in a NaN rather than infinity.

      N (NaN): It has a special encoding for NaN (Not a Number).

      UZ (Unsigned Zero): It only supports an unsigned zero.

    • UInt16

      public static final ScalarType UInt16
      16-bit unsigned integer.
    • UInt32

      public static final ScalarType UInt32
      32-bit unsigned integer.
    • UInt64

      public static final ScalarType UInt64
      64-bit unsigned integer.
  • Method Details

    • values

      public static ScalarType[] 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 ScalarType 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
    • code

      public int code()
      Returns the native ST_DType code.
      Returns:
      the native ST_DType code.