| 190 | } |
| 191 | |
| 192 | string SummarizeString(const string& str) { |
| 193 | string escaped = absl::CEscape(str); |
| 194 | |
| 195 | // If the string is long, replace the middle with ellipses. |
| 196 | constexpr int kMaxStringSummarySize = 80; |
| 197 | if (escaped.size() >= kMaxStringSummarySize) { |
| 198 | StringPiece prefix(escaped); |
| 199 | StringPiece suffix = prefix; |
| 200 | prefix.remove_suffix(escaped.size() - 10); |
| 201 | suffix.remove_prefix(escaped.size() - 10); |
| 202 | return strings::StrCat("\"", prefix, "...", suffix, "\""); |
| 203 | } else { |
| 204 | return strings::StrCat("\"", escaped, "\""); |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | string SummarizeTensor(const TensorProto& tensor_proto) { |
| 209 | Tensor t; |
no test coverage detected