MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / InsertRow

Method InsertRow

paddle/fluid/inference/utils/table_printer.cc:89–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void TablePrinter::InsertRow(const std::vector<std::string>& row) {
90 std::vector<std::vector<std::string>> table_row;
91 size_t max_height = 0;
92
93 for (size_t i = 0; i < row.size(); ++i) {
94 table_row.emplace_back();
95 std::stringstream ss(row[i]);
96 std::string line;
97 size_t max_width = 0;
98 while (std::getline(ss, line, '\n')) {
99 table_row[i].emplace_back(line);
100 if (line.length() > max_width) max_width = line.length();
101 }
102
103 if (static_cast<float>(max_width) > widths_[i])
104 widths_[i] = static_cast<float>(max_width);
105
106 size_t num_lines = table_row[i].size();
107 if (num_lines > max_height) max_height = num_lines;
108 }
109
110 heights_.emplace_back(max_height);
111 data_.emplace_back(table_row);
112}
113
114void TablePrinter::InsetDivider() {
115 heights_.emplace_back(1);

Callers 1

SummaryMethod · 0.80

Calls 3

sizeMethod · 0.45
emplace_backMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected