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

Function CopyStringFromBuffer

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

Source from the content-addressed store, hash-verified

57}
58
59void CopyStringFromBuffer(const ::tflite::Buffer& buffer, Array* array) {
60 auto* src_data = reinterpret_cast<const char*>(buffer.data()->data());
61 std::vector<string>* dst_data =
62 &array->GetMutableBuffer<ArrayDataType::kString>().data;
63 int32_t num_strings = ::tflite::GetStringCount(src_data);
64 for (int i = 0; i < num_strings; i++) {
65 ::tflite::StringRef str_ref = ::tflite::GetString(src_data, i);
66 string this_str(str_ref.str, str_ref.len);
67 dst_data->push_back(this_str);
68 }
69}
70
71template <ArrayDataType T>
72void CopyBuffer(const ::tflite::Buffer& buffer, Array* array) {

Callers 1

DeserializeMethod · 0.85

Calls 4

GetStringCountFunction · 0.85
GetStringFunction · 0.85
dataMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected