Package org.nd4j.linalg.api.buffer
Enum DataType
- java.lang.Object
-
- java.lang.Enum<DataType>
-
- org.nd4j.linalg.api.buffer.DataType
-
- All Implemented Interfaces:
Serializable,Comparable<DataType>
public enum DataType extends Enum<DataType>
Enum lists supported data types.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BFLOAT16BOOLBYTEDeprecated.Replaced byINT8, use that insteadCOMPRESSEDDOUBLEFLOATHALFDeprecated.Replaced byFLOAT16, use that insteadINTDeprecated.Replaced byINT32, use that insteadLONGDeprecated.Replaced byINT64, use that insteadSHORTDeprecated.Replaced byINT16, use that insteadUBYTEDeprecated.Replaced byUINT8, use that insteadUINT16UINT32UINT64UNKNOWNUTF8
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DataTypefromInt(int type)Values inherited from https://github.com/eclipse/deeplearning4j/blob/master/libnd4j/include/array/DataType.hstatic DataTypefromNumpy(String numpyDtypeName)booleanisFPType()booleanisIntType()booleanisNumerical()Return true if the value is numerical.
Equivalent tothis != UTF8 && this != COMPRESSED && this != UNKNOWN
Note: Boolean values are considered numerical (0/1)booleanisSigned()intprecision()inttoInt()static DataTypevalueOf(String name)Returns the enum constant of this type with the specified name.static DataType[]values()Returns an array containing the constants of this enum type, in the order they are declared.intwidth()
-
-
-
Enum Constant Detail
-
DOUBLE
public static final DataType DOUBLE
-
FLOAT
public static final DataType FLOAT
-
HALF
@Deprecated public static final DataType HALF
Deprecated.Replaced byFLOAT16, use that instead
-
LONG
@Deprecated public static final DataType LONG
Deprecated.Replaced byINT64, use that instead
-
INT
@Deprecated public static final DataType INT
Deprecated.Replaced byINT32, use that instead
-
SHORT
@Deprecated public static final DataType SHORT
Deprecated.Replaced byINT16, use that instead
-
UBYTE
@Deprecated public static final DataType UBYTE
Deprecated.Replaced byUINT8, use that instead
-
BYTE
@Deprecated public static final DataType BYTE
Deprecated.Replaced byINT8, use that instead
-
BOOL
public static final DataType BOOL
-
UTF8
public static final DataType UTF8
-
COMPRESSED
public static final DataType COMPRESSED
-
BFLOAT16
public static final DataType BFLOAT16
-
UINT16
public static final DataType UINT16
-
UINT32
public static final DataType UINT32
-
UINT64
public static final DataType UINT64
-
UNKNOWN
public static final DataType UNKNOWN
-
-
Method Detail
-
values
public static DataType[] 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 (DataType c : DataType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DataType valueOf(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:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
fromInt
public static DataType fromInt(int type)
Values inherited from https://github.com/eclipse/deeplearning4j/blob/master/libnd4j/include/array/DataType.h- Parameters:
type- the input int type- Returns:
- the appropriate data type
-
toInt
public int toInt()
-
isFPType
public boolean isFPType()
- Returns:
- Returns true if the datatype is a floating point type (double, float or half precision)
-
isIntType
public boolean isIntType()
- Returns:
- Returns true if the datatype is an integer type (long, integer, short, ubyte or byte)
-
isNumerical
public boolean isNumerical()
Return true if the value is numerical.
Equivalent tothis != UTF8 && this != COMPRESSED && this != UNKNOWN
Note: Boolean values are considered numerical (0/1)
-
isSigned
public boolean isSigned()
- Returns:
- True if the datatype is a numerical type and is signed (supports negative values)
-
precision
public int precision()
- Returns:
- the max number of significant decimal digits
-
width
public int width()
- Returns:
- For fixed-width types, this returns the number of bytes per array element
-
-