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

Function AppendArrayVal

tensorflow/lite/toco/dump_graphviz.cc:194–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194void AppendArrayVal(string* string, Array const& array, int index) {
195 if (array.buffer->type == ArrayDataType::kFloat) {
196 const auto& data = array.GetBuffer<ArrayDataType::kFloat>().data;
197 if (index >= data.size()) {
198 return;
199 }
200 AppendF(string, "%.3f", data[index]);
201 } else if (array.buffer->type == ArrayDataType::kUint8) {
202 const auto& data = array.GetBuffer<ArrayDataType::kUint8>().data;
203 if (index >= data.size()) {
204 return;
205 }
206 AppendF(string, "%d", data[index]);
207 } else if (array.buffer->type == ArrayDataType::kInt16) {
208 const auto& data = array.GetBuffer<ArrayDataType::kInt16>().data;
209 if (index >= data.size()) {
210 return;
211 }
212 AppendF(string, "%d", data[index]);
213 } else if (array.buffer->type == ArrayDataType::kInt32) {
214 const auto& data = array.GetBuffer<ArrayDataType::kInt32>().data;
215 if (index >= data.size()) {
216 return;
217 }
218 AppendF(string, "%d", data[index]);
219 } else if (array.buffer->type == ArrayDataType::kInt64) {
220 const auto& data = array.GetBuffer<ArrayDataType::kInt64>().data;
221 if (index >= data.size()) {
222 return;
223 }
224 AppendF(string, "%d", data[index]);
225 } else if (array.buffer->type == ArrayDataType::kBool) {
226 const auto& data = array.GetBuffer<ArrayDataType::kBool>().data;
227 if (index >= data.size()) {
228 return;
229 }
230 AppendF(string, "%d", data[index]);
231 }
232}
233
234typedef std::map<string, string> Attributes;
235

Callers 1

GetArrayLabelFunction · 0.85

Calls 2

AppendFFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected