16 size_t max_length_name = 0;
18 max_length_name =
std::max(max_length_name,
name.length());
22 static const std::unordered_map<ONNXTensorElementDataType, std::string> typeMap = {
23 {ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT,
"float"},
24 {ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_DOUBLE,
"double"},
25 {ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8,
"int8"},
26 {ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_INT16,
"int16"},
27 {ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32,
"int32"},
28 {ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64,
"int64"},
29 {ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8,
"uint8"},
30 {ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT16,
"uint16"},
31 {ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT32,
"uint32"},
32 {ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT64,
"uint64"},
33 {ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_BOOL,
"bool"},
37 size_t max_length_shape = 0;
38 std::vector<std::string> shape_strs;
39 for (
const auto& shape: shapes) {
40 std::string shape_str =
"[";
41 for (
size_t j = 0; j < shape.size(); ++j) {
43 if (j != shape.size() - 1) {
48 size_t l = shape_str.length();
49 shape_strs.push_back(std::move(shape_str));
50 max_length_shape =
std::max(max_length_shape,
l);
53 int line_length = max_length_name + 4 + 10 + 3 + max_length_shape;
54 std::string h_line(line_length,
'-');
55 std::cout << h_line << std::endl;
58 std::ios_base::fmtflags
f( std::cout.
flags() );
59 std::cout << std::left << std::setw(max_length_name + 4) <<
" name";
60 std::cout << std::setw(10) <<
"type";
61 std::cout <<
"shape" << std::endl;
63 std::cout << h_line << std::endl;
65 for (
size_t i = 0;
i <
names.size();
i++) {
66 std::cout << std::left << std::setw(max_length_name + 4) <<
" " +
names.at(
i);
67 std::cout << std::setw(10) << typeMap.at(
types.at(
i));
68 std::cout << shape_strs.at(
i) << std::endl;
70 std::cout << h_line << std::endl;