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

Function PrintInterpreterState

tensorflow/lite/optional_debug_tools.cc:82–118  ·  view source on GitHub ↗

Prints a dump of what tensors and what nodes are in the interpreter.

Source from the content-addressed store, hash-verified

80
81// Prints a dump of what tensors and what nodes are in the interpreter.
82void PrintInterpreterState(Interpreter* interpreter) {
83 printf("Interpreter has %zu tensors and %zu nodes\n",
84 interpreter->tensors_size(), interpreter->nodes_size());
85 printf("Inputs:");
86 PrintIntVector(interpreter->inputs());
87 printf("Outputs:");
88 PrintIntVector(interpreter->outputs());
89 printf("\n");
90 for (size_t tensor_index = 0; tensor_index < interpreter->tensors_size();
91 tensor_index++) {
92 TfLiteTensor* tensor = interpreter->tensor(static_cast<int>(tensor_index));
93 printf("Tensor %3zu %-20s %10s %15s %10zu bytes (%4.1f MB) ", tensor_index,
94 tensor->name, TensorTypeName(tensor->type),
95 AllocTypeName(tensor->allocation_type), tensor->bytes,
96 (static_cast<float>(tensor->bytes) / (1 << 20)));
97 PrintTfLiteIntVector(tensor->dims);
98 }
99 printf("\n");
100 for (size_t node_index = 0; node_index < interpreter->nodes_size();
101 node_index++) {
102 const std::pair<TfLiteNode, TfLiteRegistration>* node_and_reg =
103 interpreter->node_and_registration(static_cast<int>(node_index));
104 const TfLiteNode& node = node_and_reg->first;
105 const TfLiteRegistration& reg = node_and_reg->second;
106 if (reg.custom_name != nullptr) {
107 printf("Node %3zu Operator Custom Name %s\n", node_index,
108 reg.custom_name);
109 } else {
110 printf("Node %3zu Operator Builtin Code %3d\n", node_index,
111 reg.builtin_code);
112 }
113 printf(" Inputs:");
114 PrintTfLiteIntVector(node.inputs);
115 printf(" Outputs:");
116 PrintTfLiteIntVector(node.outputs);
117 }
118}
119
120} // namespace tflite

Callers 3

mainFunction · 0.85
RunInferenceFunction · 0.85
mainFunction · 0.85

Calls 10

PrintIntVectorFunction · 0.85
TensorTypeNameFunction · 0.85
AllocTypeNameFunction · 0.85
PrintTfLiteIntVectorFunction · 0.85
tensors_sizeMethod · 0.45
nodes_sizeMethod · 0.45
inputsMethod · 0.45
outputsMethod · 0.45
tensorMethod · 0.45
node_and_registrationMethod · 0.45

Tested by

no test coverage detected