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

Method ReadOutput

tensorflow/lite/testing/tflite_driver.cc:512–539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510}
511
512string TfLiteDriver::ReadOutput(int id) {
513 auto* tensor = interpreter_->tensor(id);
514 int num_elements = 1;
515
516 for (int i = 0; i < tensor->dims->size; ++i) {
517 num_elements *= tensor->dims->data[i];
518 }
519
520 switch (tensor->type) {
521 case kTfLiteFloat32:
522 return JoinDefault(tensor->data.f, num_elements, ",");
523 case kTfLiteInt32:
524 return JoinDefault(tensor->data.i32, num_elements, ",");
525 case kTfLiteInt64:
526 return JoinDefault(tensor->data.i64, num_elements, ",");
527 case kTfLiteUInt8:
528 return Join(tensor->data.uint8, num_elements, ",");
529 case kTfLiteInt8:
530 return Join(tensor->data.int8, num_elements, ",");
531 case kTfLiteBool:
532 return JoinDefault(tensor->data.b, num_elements, ",");
533 default:
534 Invalidate(absl::StrCat("Unsupported tensor type ",
535 TfLiteTypeGetName(tensor->type),
536 " in TfLiteDriver::ReadOutput"));
537 return "";
538 }
539}
540
541} // namespace testing
542} // namespace tflite

Callers

nothing calls this directly

Calls 5

JoinDefaultFunction · 0.85
TfLiteTypeGetNameFunction · 0.85
JoinFunction · 0.70
StrCatFunction · 0.50
tensorMethod · 0.45

Tested by

no test coverage detected