Skip to content

Commit d6bc681

Browse files
authored
add variable type (#6031) (#6032)
1 parent 76d502e commit d6bc681

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lite/model_parser/base/traits.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,16 @@ inline VarDataType ConvertPrecisionType(lite_api::PrecisionType type) {
8080
return lite::VarDataType::vtype; \
8181
break
8282
switch (type) {
83-
CASE(Float, FP32);
83+
CASE(Bool, BOOL);
8484
CASE(Int8, INT8);
85+
CASE(UInt8, UINT8);
86+
CASE(Int16, INT16);
8587
CASE(Int32, INT32);
86-
CASE(FP16, FP16);
87-
CASE(Bool, BOOL);
8888
CASE(Int64, INT64);
89-
CASE(Int16, INT16);
89+
CASE(FP16, FP16);
90+
CASE(Float, FP32);
9091
default:
91-
LOG(FATAL) << "Illegal flatbuffer VarType.";
92+
LOG(FATAL) << "Illegal flatbuffer VarType." << static_cast<int>(type);
9293
return lite::VarDataType();
9394
}
9495
#undef CASE
@@ -100,15 +101,16 @@ inline lite_api::PrecisionType ConvertPrecisionType(VarDataType type) {
100101
return lite_api::PrecisionType::k##ptype; \
101102
break
102103
switch (type) {
103-
CASE(Float, FP32);
104+
CASE(Bool, BOOL);
104105
CASE(Int8, INT8);
106+
CASE(UInt8, UINT8);
107+
CASE(Int16, INT16);
105108
CASE(Int32, INT32);
106-
CASE(FP16, FP16);
107-
CASE(Bool, BOOL);
108109
CASE(Int64, INT64);
109-
CASE(Int16, INT16);
110+
CASE(FP16, FP16);
111+
CASE(Float, FP32);
110112
default:
111-
LOG(FATAL) << "Illegal flatbuffer VarType.";
113+
LOG(FATAL) << "Illegal flatbuffer VarType: " << static_cast<int>(type);
112114
return lite_api::PrecisionType();
113115
}
114116
#undef CASE

0 commit comments

Comments
 (0)