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

Method SummarizeValue

tensorflow/core/framework/tensor.cc:1200–1286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1198} // namespace
1199
1200string Tensor::SummarizeValue(int64 max_entries, bool print_v2) const {
1201 const int64 num_elts = NumElements();
1202 if (max_entries < 0) {
1203 max_entries = num_elts;
1204 }
1205 size_t limit = std::min(max_entries, num_elts);
1206 if ((limit > 0) && (buf_ == nullptr)) {
1207 return strings::StrCat("uninitialized Tensor of ", num_elts,
1208 " elements of type ", dtype());
1209 }
1210 const char* data = limit > 0 ? tensor_data().data() : nullptr;
1211 switch (dtype()) {
1212 case DT_HALF:
1213 return SummarizeArray<Eigen::half>(limit, num_elts, shape_, data,
1214 print_v2);
1215 break;
1216 case DT_FLOAT:
1217 return SummarizeArray<float>(limit, num_elts, shape_, data, print_v2);
1218 break;
1219 case DT_DOUBLE:
1220 return SummarizeArray<double>(limit, num_elts, shape_, data, print_v2);
1221 break;
1222 case DT_UINT32:
1223 return SummarizeArray<uint32>(limit, num_elts, shape_, data, print_v2);
1224 break;
1225 case DT_INT32:
1226 return SummarizeArray<int32>(limit, num_elts, shape_, data, print_v2);
1227 break;
1228 case DT_UINT8:
1229 case DT_QUINT8:
1230 return SummarizeArray<uint8>(limit, num_elts, shape_, data, print_v2);
1231 break;
1232 case DT_UINT16:
1233 case DT_QUINT16:
1234 return SummarizeArray<uint16>(limit, num_elts, shape_, data, print_v2);
1235 break;
1236 case DT_INT16:
1237 case DT_QINT16:
1238 return SummarizeArray<int16>(limit, num_elts, shape_, data, print_v2);
1239 break;
1240 case DT_INT8:
1241 case DT_QINT8:
1242 return SummarizeArray<int8>(limit, num_elts, shape_, data, print_v2);
1243 break;
1244 case DT_UINT64:
1245 return SummarizeArray<uint64>(limit, num_elts, shape_, data, print_v2);
1246 break;
1247 case DT_INT64:
1248 return SummarizeArray<int64>(limit, num_elts, shape_, data, print_v2);
1249 break;
1250 case DT_BOOL:
1251 // TODO(tucker): Is it better to emit "True False..."? This
1252 // will emit "1 0..." which is more compact.
1253 return SummarizeArray<bool>(limit, num_elts, shape_, data, print_v2);
1254 break;
1255 case DT_STRING:
1256 return SummarizeArray<tstring>(limit, num_elts, shape_, data, print_v2);
1257 break;

Callers 15

ChecksumFunction · 0.80
TEST_FFunction · 0.80
TESTFunction · 0.80
AttachContextMethod · 0.80
RunTestMethod · 0.80
TensorDebugStringMethod · 0.80
RunTestMethod · 0.80
DebugStringMethod · 0.80
BM_chain_opsFunction · 0.80
CheckInvalidLabelIndexFunction · 0.80
ComputeMethod · 0.80
ComputeMethod · 0.80

Calls 7

NumElementsFunction · 0.50
minFunction · 0.50
StrCatFunction · 0.50
dtypeFunction · 0.50
StrAppendFunction · 0.50
dataMethod · 0.45
DebugStringMethod · 0.45

Tested by 5

TEST_FFunction · 0.64
TESTFunction · 0.64
RunTestMethod · 0.64
RunTestMethod · 0.64
BM_chain_opsFunction · 0.64