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

Function main

tensorflow/lite/testing/tflite_diff_example_test.cc:20–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18#include "tensorflow/lite/testing/tflite_diff_util.h"
19
20int main(int argc, char** argv) {
21 ::tflite::InitTensorFlow(); // For Flex support.
22
23 ::tflite::testing::DiffOptions options =
24 ::tflite::testing::ParseTfliteDiffFlags(&argc, argv);
25 if (options.tensorflow_model.empty()) return 1;
26
27 int failure_count = 0;
28 for (int i = 0; i < options.num_runs_per_pass; i++) {
29 if (!tflite::testing::RunDiffTest(options, /*num_invocations=*/1)) {
30 ++failure_count;
31 }
32 }
33 int failures_in_first_pass = failure_count;
34
35 if (failure_count == 0) {
36 // Let's try again with num_invocations > 1 to make sure we can do multiple
37 // invocations without resetting the interpreter.
38 for (int i = 0; i < options.num_runs_per_pass; i++) {
39 if (!tflite::testing::RunDiffTest(options, /*num_invocations=*/2)) {
40 ++failure_count;
41 }
42 }
43 }
44
45 fprintf(stderr, "Num errors in single-inference pass: %d\n",
46 failures_in_first_pass);
47 fprintf(stderr, "Num errors in multi-inference pass : %d\n",
48 failure_count - failures_in_first_pass);
49
50 return failure_count != 0 ? 1 : 0;
51}

Callers

nothing calls this directly

Calls 4

InitTensorFlowFunction · 0.85
ParseTfliteDiffFlagsFunction · 0.85
RunDiffTestFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected