| 365 | } |
| 366 | |
| 367 | string 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 | |
| 404 | int64 BatchDescriptor::NodesPerFeatureMap() const { |
| 405 | int64 ret = 1; |
no test coverage detected