Only log recorded allocations if any bytes were used or requested in a given bucket.

PiperOrigin-RevId: 336275933
Change-Id: I4359695cd5f48c671910259b3b677952a5281803
This commit is contained in:
Nick Kreeger 2020-10-09 05:31:24 -07:00 committed by TensorFlower Gardener
parent 982ee24e7c
commit a68af2830a

View File

@ -118,12 +118,14 @@ void RecordingMicroAllocator::PrintRecordedAllocation(
const char* allocation_description) const {
#ifndef TF_LITE_STRIP_ERROR_STRINGS
RecordedAllocation allocation = GetRecordedAllocation(allocation_type);
TF_LITE_REPORT_ERROR(
error_reporter(),
"[RecordingMicroAllocator] '%s' used %d bytes with alignment overhead "
"(requested %d bytes for %d %s)",
allocation_name, allocation.used_bytes, allocation.requested_bytes,
allocation.count, allocation_description);
if (allocation.used_bytes > 0 || allocation.requested_bytes > 0) {
TF_LITE_REPORT_ERROR(
error_reporter(),
"[RecordingMicroAllocator] '%s' used %d bytes with alignment overhead "
"(requested %d bytes for %d %s)",
allocation_name, allocation.used_bytes, allocation.requested_bytes,
allocation.count, allocation_description);
}
#endif
}