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

Function SummarizeArray

tensorflow/core/framework/tensor.cc:1170–1197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1168
1169template <typename T>
1170string SummarizeArray(int64 limit, int64 num_elts,
1171 const TensorShape& tensor_shape, const char* data,
1172 const bool print_v2) {
1173 string ret;
1174 const T* array = reinterpret_cast<const T*>(data);
1175
1176 const gtl::InlinedVector<int64, 4> shape = tensor_shape.dim_sizes();
1177 if (shape.empty()) {
1178 for (int64 i = 0; i < limit; ++i) {
1179 if (i > 0) strings::StrAppend(&ret, " ");
1180 strings::StrAppend(&ret, PrintOneElement(array[i], print_v2));
1181 }
1182 if (num_elts > limit) strings::StrAppend(&ret, "...");
1183 return ret;
1184 }
1185 if (print_v2) {
1186 const int num_dims = tensor_shape.dims();
1187 PrintOneDimV2(0, shape, limit, num_dims, array, 0, &ret);
1188 } else {
1189 int64 data_index = 0;
1190 const int shape_size = tensor_shape.dims();
1191 PrintOneDim(0, shape, limit, shape_size, array, &data_index, &ret);
1192
1193 if (num_elts > limit) strings::StrAppend(&ret, "...");
1194 }
1195
1196 return ret;
1197}
1198} // namespace
1199
1200string Tensor::SummarizeValue(int64 max_entries, bool print_v2) const {

Callers

nothing calls this directly

Calls 7

PrintOneElementFunction · 0.85
PrintOneDimV2Function · 0.85
PrintOneDimFunction · 0.85
StrAppendFunction · 0.50
dim_sizesMethod · 0.45
emptyMethod · 0.45
dimsMethod · 0.45

Tested by

no test coverage detected