| 55 | } |
| 56 | |
| 57 | static void PrintInputOutputInfo(const Runtime* runtime) { |
| 58 | cout << "----- input info -----" << endl; |
| 59 | for (uint32_t i = 0; i < runtime->GetInputCount(); ++i) { |
| 60 | auto tensor = runtime->GetInputTensor(i); |
| 61 | cout << "input[" << i << "]:" << endl << " name: " << tensor->GetName() << endl; |
| 62 | |
| 63 | string dims_str; |
| 64 | auto& shape = *tensor->GetShape(); |
| 65 | for (uint32_t j = 0; j < shape.GetDimCount(); ++j) { |
| 66 | dims_str += " " + std::to_string(shape.GetDim(j)); |
| 67 | } |
| 68 | cout << " dim(s):" << dims_str << endl |
| 69 | << " DataType: " << GetDataTypeStr(shape.GetDataType()) << endl |
| 70 | << " DataFormat: " << GetDataFormatStr(shape.GetDataFormat()) << endl |
| 71 | << " BytesIncludePadding: " << shape.CalcBytesIncludingPadding() << endl |
| 72 | << " BytesExcludePadding: " << shape.CalcBytesExcludingPadding() << endl; |
| 73 | } |
| 74 | |
| 75 | cout << "----- output info -----" << endl; |
| 76 | for (uint32_t i = 0; i < runtime->GetOutputCount(); ++i) { |
| 77 | auto tensor = runtime->GetOutputTensor(i); |
| 78 | cout << "output[" << i << "]:" << endl << " name: " << tensor->GetName(); |
| 79 | |
| 80 | string dims_str; |
| 81 | auto& shape = *tensor->GetShape(); |
| 82 | for (uint32_t j = 0; j < shape.GetDimCount(); ++j) { |
| 83 | dims_str += " " + std::to_string(shape.GetDim(j)); |
| 84 | } |
| 85 | cout << " dim(s):" << dims_str << endl |
| 86 | << " DataType: " << GetDataTypeStr(shape.GetDataType()) << endl |
| 87 | << " DataFormat: " << GetDataFormatStr(shape.GetDataFormat()) << endl |
| 88 | << " BytesIncludePadding: " << shape.CalcBytesIncludingPadding() << endl |
| 89 | << " BytesExcludePadding: " << shape.CalcBytesExcludingPadding() << endl; |
| 90 | } |
| 91 | |
| 92 | cout << "----------------------" << endl; |
| 93 | } |
| 94 | |
| 95 | int main(void) { |
| 96 | const char* model_file = "tests/testdata/conv.onnx"; |
no test coverage detected