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

Function SummarizeString

tensorflow/core/framework/attr_value_util.cc:192–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192string 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
208string SummarizeTensor(const TensorProto& tensor_proto) {
209 Tensor t;

Callers 1

SummarizeAttrValueFunction · 0.85

Calls 3

CEscapeFunction · 0.85
StrCatFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected