Class DataType

Class Documentation

class DataType

Supported data types. The ALL_CAPS aliases are deprecated and will be removed.

Public Types

enum Value

Values:

enumerator Bool
enumerator BOOL
enumerator Uint8
enumerator UINT8
enumerator Uint16
enumerator UINT16
enumerator Uint32
enumerator UINT32
enumerator Uint64
enumerator UINT64
enumerator Int8
enumerator INT8
enumerator Int16
enumerator INT16
enumerator Int32
enumerator INT32
enumerator Int64
enumerator INT64
enumerator Fp16
enumerator Float16
enumerator FP16
enumerator Fp32
enumerator Float32
enumerator FP32
enumerator Fp64
enumerator Float64
enumerator FP64
enumerator String
enumerator STRING
enumerator Unknown
enumerator UNKNOWN

Public Functions

constexpr DataType() = default

Constructs a new DataType object.

inline explicit constexpr DataType(const char *value)

Constructs a new DataType object.

Parameters

value – string to identify the initial value of the new datatype

inline constexpr DataType(DataType::Value value)

Constructs a new DataType object.

Parameters

value – datatype to identify the initial value of the new datatype

inline constexpr operator Value() const

Implicit conversion between the Datatype class and its internal value.

inline constexpr size_t size() const

Get the size in bytes associated with a data type.

Returns

constexpr size_t

inline constexpr const char *str() const

Given a type, return a string corresponding to the type. KServe requires the string form to be specific values and in all caps. This adheres to that. If these string values are changed, then each server will need to map the values to the ones KServe expects.

Returns

const char*

Friends

friend std::ostream &operator<<(std::ostream &os, const DataType &value)

Print support for the DataType class.

Parameters
  • os – stream to print to

  • value – Datatype instance to print

Returns

std::ostream&