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

Method ToShortString

tensorflow/stream_executor/dnn.cc:367–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365}
366
367string BatchDescriptor::ToShortString() const {
368 // All the constituent strings are less than 15 characters, so the
369 // small string optimization ensures that there will be at most one
370 // heap memory allocation.
371 string depth = absl::StrCat("d", feature_map_count());
372 string batch = absl::StrCat("b", count());
373
374 string spatial = "s";
375 for (int i = 0; i < ndims(); i++) {
376 absl::StrAppendFormat(&spatial, "%d ", spatial_size()[i]);
377 }
378
379 string suffix;
380 if (value_min() != value_max()) {
381 absl::StrAppend(&suffix, "[", value_min(), ";", value_max(), "]");
382 }
383 if (quantized_activation_mode() == QuantizedActivationMode::k16Bit) {
384 suffix += "_16bit";
385 }
386
387 switch (layout()) {
388 case DataLayout::kYXDepthBatch:
389 return absl::StrCat(spatial, depth, batch, suffix);
390 case DataLayout::kYXBatchDepth:
391 return absl::StrCat(spatial, batch, depth, suffix);
392 case DataLayout::kBatchYXDepth:
393 return absl::StrCat(batch, spatial, depth, suffix);
394 case DataLayout::kBatchDepthYX:
395 return absl::StrCat(batch, depth, spatial, suffix);
396 case DataLayout::kBatchDepthYX4:
397 return absl::StrCat(batch, depth, spatial, suffix, "(VECT_C)");
398 default:
399 LOG(FATAL) << "Unknown layout " << static_cast<int32>(layout());
400 return ""; // Avoid return warning (unreachable)
401 }
402}
403
404int64 BatchDescriptor::NodesPerFeatureMap() const {
405 int64 ret = 1;

Callers 1

ToVlogStringFunction · 0.45

Calls 4

countFunction · 0.85
paddingFunction · 0.85
StrCatFunction · 0.50
StrAppendFunction · 0.50

Tested by

no test coverage detected