Enum Class ScalarType
- All Implemented Interfaces:
Serializable, Comparable<ScalarType>, Constable
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 ConstantsEnum ConstantDescriptionThe 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 PyTorchtorch.uint8/torch.Byte). -
Method Summary
Modifier and TypeMethodDescriptionintcode()Returns the nativeST_DTypecode.static ScalarTypeReturns the enum constant of this class with the specified name.static ScalarType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UInt8
8-bit unsigned integer (maps to PyTorchtorch.uint8/torch.Byte). Note: PyTorch usesBytefor the unsigned 8-bit type, so Javabytevalues are interpreted in the range [0, 255] when converting to/from this type. -
Int8
8-bit signed integer. -
Int16
16-bit signed integer. -
Int32
32-bit signed integer. -
Int64
64-bit signed integer. -
Half
Half-precision floating-point number. It contains 5 exponent bits and 11 11-bit precision (10 explicitly stored). -
Float
Single-precision floating-point number. -
Double
Double-precision floating-point number. -
ComplexHalf
Half-precision floating-point complex number. -
ComplexFloat
Single-precision floating-point complex number. -
ComplexDouble
Double-precision floating-point complex number. -
Bool
Boolean data type. -
QUInt8
8-bit quantized unsigned tensor type which represents a compressed floating point tensor. -
QInt8
8-bit quantized signed tensor type which represents a compressed floating point tensor. -
QInt32
32-bit quantized signed tensor type which represents a compressed floating point tensor. -
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
4-bit unsigned quantized integer, packed into standard 8-bit bytes. -
QUInt2x4
2-bit unsigned quantized integer, packed into standard 8-bit bytes. -
Bits1x8
Uninterpreted 1-bit values, packed into standard 8-bit bytes. -
Bits2x4
Uninterpreted 2-bit values, packed into standard 8-bit bytes. -
Bits4x2
Uninterpreted 4-bit values, packed into standard 8-bit bytes. -
Bits8
Uninterpreted 8-bit values. -
Bits16
Uninterpreted 16-bit values. -
Float8e5m2
8-bit floating point, S-E-M 1-5-2. -
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
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
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
16-bit unsigned integer. -
UInt32
32-bit unsigned integer. -
UInt64
64-bit unsigned integer.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
code
public int code()Returns the nativeST_DTypecode.- Returns:
- the native
ST_DTypecode.
-