Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tensorflow/compiler/mlir/lite/core/c/tflite_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ typedef enum {
kTfLiteInt4 = 18,
kTfLiteBFloat16 = 19,
kTfLiteInt2 = 20,
kTfLiteUInt4 = 21,
} TfLiteType;
// LINT.ThenChange(//tensorflow/lite/profiling/proto/model_runtime_info.proto:EdgeDataType)

Expand Down
1 change: 1 addition & 0 deletions tensorflow/compiler/mlir/lite/schema/schema.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ enum TensorType : byte {
INT4 = 17,
BFLOAT16 = 18,
INT2 = 19,
UINT4 = 20,
}

// Custom quantization parameters for experimenting with new quantization
Expand Down
3 changes: 3 additions & 0 deletions tensorflow/lite/core/api/flatbuffer_conversions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,9 @@ TfLiteStatus ConvertTensorType(TensorType tensor_type, TfLiteType* type,
case TensorType_INT2:
*type = kTfLiteInt2;
return kTfLiteOk;
case TensorType_UINT4:
*type = kTfLiteUInt4;
return kTfLiteOk;
default:
*type = kTfLiteNoType;
TF_LITE_REPORT_ERROR(error_reporter,
Expand Down
2 changes: 2 additions & 0 deletions tensorflow/lite/core/c/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ const char* TfLiteTypeGetName(TfLiteType type) {
return "INT4";
case kTfLiteInt2:
return "INT2";
case kTfLiteUInt4:
return "UINT4";
}
return "Unknown type";
}
Expand Down
1 change: 1 addition & 0 deletions tensorflow/lite/python/schema_py_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class TensorType(object):
INT4 = 17
BFLOAT16 = 18
INT2 = 19
UINT4 = 20


class QuantizationDetails(object):
Expand Down
13 changes: 8 additions & 5 deletions tensorflow/lite/schema/schema_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -712,11 +712,12 @@ enum TensorType : int8_t {
TensorType_INT4 = 17,
TensorType_BFLOAT16 = 18,
TensorType_INT2 = 19,
TensorType_UINT4 = 20,
TensorType_MIN = TensorType_FLOAT32,
TensorType_MAX = TensorType_INT2
TensorType_MAX = TensorType_UINT4
};

inline const TensorType (&EnumValuesTensorType())[20] {
inline const TensorType (&EnumValuesTensorType())[21] {
static const TensorType values[] = {
TensorType_FLOAT32,
TensorType_FLOAT16,
Expand All @@ -737,13 +738,14 @@ inline const TensorType (&EnumValuesTensorType())[20] {
TensorType_UINT16,
TensorType_INT4,
TensorType_BFLOAT16,
TensorType_INT2
TensorType_INT2,
TensorType_UINT4
};
return values;
}

inline const char * const *EnumNamesTensorType() {
static const char * const names[21] = {
static const char * const names[22] = {
"FLOAT32",
"FLOAT16",
"INT32",
Expand All @@ -764,13 +766,14 @@ inline const char * const *EnumNamesTensorType() {
"INT4",
"BFLOAT16",
"INT2",
"UINT4",
nullptr
};
return names;
}

inline const char *EnumNameTensorType(TensorType e) {
if (::flatbuffers::IsOutRange(e, TensorType_FLOAT32, TensorType_INT2)) return "";
if (::flatbuffers::IsOutRange(e, TensorType_FLOAT32, TensorType_UINT4)) return "";
const size_t index = static_cast<size_t>(e);
return EnumNamesTensorType()[index];
}
Expand Down
Loading