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

Method SetExpectation

tensorflow/lite/testing/tflite_driver.cc:415–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415void TfLiteDriver::SetExpectation(int id, const string& csv_values) {
416 if (!IsValid()) return;
417 auto* tensor = interpreter_->tensor(id);
418 if (expected_output_.count(id) != 0) {
419 Invalidate(absl::StrCat("Overridden expectation for tensor '", id, "'"));
420 }
421 expected_output_[id].reset(
422 new Expectation(relative_threshold_, absolute_threshold_));
423 switch (tensor->type) {
424 case kTfLiteFloat32:
425 expected_output_[id]->SetData<float>(csv_values);
426 break;
427 case kTfLiteInt32:
428 expected_output_[id]->SetData<int32_t>(csv_values);
429 break;
430 case kTfLiteInt64:
431 expected_output_[id]->SetData<int64_t>(csv_values);
432 break;
433 case kTfLiteUInt8:
434 expected_output_[id]->SetData<uint8_t>(csv_values);
435 break;
436 case kTfLiteInt8:
437 expected_output_[id]->SetData<int8_t>(csv_values);
438 break;
439 case kTfLiteBool:
440 expected_output_[id]->SetData<bool>(csv_values);
441 break;
442 case kTfLiteString:
443 expected_output_[id]->SetData<string>(csv_values);
444 break;
445 case kTfLiteComplex64:
446 expected_output_[id]->SetData<std::complex<float>>(csv_values);
447 break;
448 default:
449 Invalidate(absl::StrCat("Unsupported tensor type ",
450 TfLiteTypeGetName(tensor->type),
451 " in TfLiteDriver::SetExpectation"));
452 return;
453 }
454}
455
456void TfLiteDriver::SetShapeExpectation(int id, const string& csv_values) {
457 if (!IsValid()) return;

Callers 2

SetFieldMethod · 0.45
TESTFunction · 0.45

Calls 7

IsValidFunction · 0.85
TfLiteTypeGetNameFunction · 0.85
SetData<string>Method · 0.80
StrCatFunction · 0.50
tensorMethod · 0.45
countMethod · 0.45
resetMethod · 0.45

Tested by 2

SetFieldMethod · 0.36
TESTFunction · 0.36