From 6d0c3acc5a728652b77914a38482f9592578e0df Mon Sep 17 00:00:00 2001 From: Jie Date: Tue, 17 Jul 2018 15:07:50 -0700 Subject: 1. rename class member variables with trailing underscore 2. change unique_ptr allocator type to base class. --- tensorflow/contrib/tensorrt/resources/trt_allocator.cc | 12 ++++++------ tensorflow/contrib/tensorrt/resources/trt_allocator.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'tensorflow/contrib/tensorrt/resources') diff --git a/tensorflow/contrib/tensorrt/resources/trt_allocator.cc b/tensorflow/contrib/tensorrt/resources/trt_allocator.cc index d21f2783d4..b55cba3bf3 100644 --- a/tensorflow/contrib/tensorrt/resources/trt_allocator.cc +++ b/tensorflow/contrib/tensorrt/resources/trt_allocator.cc @@ -43,13 +43,13 @@ void* TRTDeviceAllocator::allocate(uint64_t size, uint64_t alignment, void* mem = allocator_->AllocateRaw(alignment, size + alignment); CHECK(mem); - CHECK(mem_pool.insert(mem).second); + CHECK(mem_pool_.insert(mem).second); void* alloc_mem = mem; uint64_t total_size = size + alignment; std::align(alignment, size, mem, total_size); CHECK(mem); if (mem != alloc_mem) { - CHECK(mem_map.insert({mem, alloc_mem}).second); + CHECK(mem_map_.insert({mem, alloc_mem}).second); } VLOG(2) << "Allocated " << size << " bytes with alignment " << alignment << " @ " << mem; @@ -65,12 +65,12 @@ void TRTDeviceAllocator::free(void* memory) { VLOG(2) << "Deallocating @ " << memory; // allocated memory adjusted for alignment, restore the original pointer - auto alloc_mem = mem_map.find(memory); - if (alloc_mem != mem_map.end()) { + auto alloc_mem = mem_map_.find(memory); + if (alloc_mem != mem_map_.end()) { memory = alloc_mem->second; - mem_map.erase(alloc_mem->first); + mem_map_.erase(alloc_mem->first); } - CHECK(mem_pool.erase(memory) != 0); + CHECK(mem_pool_.erase(memory) != 0); allocator_->DeallocateRaw(memory); } diff --git a/tensorflow/contrib/tensorrt/resources/trt_allocator.h b/tensorflow/contrib/tensorrt/resources/trt_allocator.h index e405d06cc4..294b76a333 100644 --- a/tensorflow/contrib/tensorrt/resources/trt_allocator.h +++ b/tensorflow/contrib/tensorrt/resources/trt_allocator.h @@ -68,8 +68,8 @@ class TRTDeviceAllocator : public TRTBaseAllocator { tensorflow::Allocator* allocator_; // supporting alignment from allocation request requires a map to free; - std::unordered_map mem_map; - std::unordered_set mem_pool; + std::unordered_map mem_map_; + std::unordered_set mem_pool_; }; } // namespace tensorrt -- cgit v1.2.3