From 1499585ea64bb1ea922d34378579c60dd8802d87 Mon Sep 17 00:00:00 2001 From: tg-at-google Date: Tue, 2 Jun 2020 10:59:06 -0400 Subject: [PATCH] in resolution of [Wsign-compare] warning id 10 LargeAllocationWarningBytes() is implied to be a quantity ( it calls AvailableRam(), which unless improperly named, is a quantity/ i.e. non-negative ). Given LargeAllocationWarningBytes() is a quantity, it can be cast to size_t with behavior constrained to be as-intend. --- tensorflow/core/framework/cpu_allocator_impl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/core/framework/cpu_allocator_impl.cc b/tensorflow/core/framework/cpu_allocator_impl.cc index 1faee8986b8..814233074fb 100644 --- a/tensorflow/core/framework/cpu_allocator_impl.cc +++ b/tensorflow/core/framework/cpu_allocator_impl.cc @@ -75,7 +75,7 @@ class CPUAllocator : public Allocator { string Name() override { return "cpu"; } void* AllocateRaw(size_t alignment, size_t num_bytes) override { - if (num_bytes > LargeAllocationWarningBytes() && + if (num_bytes > static_cast(LargeAllocationWarningBytes()) && single_allocation_warning_count_ < kMaxSingleAllocationWarnings) { ++single_allocation_warning_count_; LOG(WARNING) << "Allocation of " << num_bytes << " exceeds "