MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Serialize

Method Serialize

tensorflow/lite/toco/tflite/types.cc:87–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85} // namespace
86
87::tflite::TensorType DataType::Serialize(ArrayDataType array_data_type) {
88 switch (array_data_type) {
89 case ArrayDataType::kFloat:
90 return ::tflite::TensorType_FLOAT32;
91 case ArrayDataType::kInt16:
92 return ::tflite::TensorType_INT16;
93 case ArrayDataType::kInt32:
94 return ::tflite::TensorType_INT32;
95 case ArrayDataType::kInt64:
96 return ::tflite::TensorType_INT64;
97 case ArrayDataType::kUint8:
98 return ::tflite::TensorType_UINT8;
99 case ArrayDataType::kString:
100 return ::tflite::TensorType_STRING;
101 case ArrayDataType::kBool:
102 return ::tflite::TensorType_BOOL;
103 case ArrayDataType::kComplex64:
104 return ::tflite::TensorType_COMPLEX64;
105 default:
106 // FLOAT32 is filled for unknown data types.
107 // TODO(ycling): Implement type inference in TF Lite interpreter.
108 return ::tflite::TensorType_FLOAT32;
109 }
110}
111
112ArrayDataType DataType::Deserialize(int tensor_type) {
113 switch (::tflite::TensorType(tensor_type)) {

Callers 2

ExportOperatorsFunction · 0.45

Calls 2

CopyStringToBufferFunction · 0.85
CopyBoolToBufferFunction · 0.85

Tested by 1