diff options
author | Jie <jiej@nvidia.com> | 2018-07-17 15:07:50 -0700 |
---|---|---|
committer | Jie <jiej@nvidia.com> | 2018-07-17 15:07:50 -0700 |
commit | 6d0c3acc5a728652b77914a38482f9592578e0df (patch) | |
tree | 3f927ef1ceb1db1744bc898d952bb413a21a905c /tensorflow/contrib/tensorrt/resources | |
parent | c8f0730484376c3020804fcf1639f55934b70cbe (diff) |
1. rename class member variables with trailing underscore
2. change unique_ptr allocator type to base class.
Diffstat (limited to 'tensorflow/contrib/tensorrt/resources')
-rw-r--r-- | tensorflow/contrib/tensorrt/resources/trt_allocator.cc | 12 | ||||
-rw-r--r-- | tensorflow/contrib/tensorrt/resources/trt_allocator.h | 4 |
2 files changed, 8 insertions, 8 deletions
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<void*, void*> mem_map; - std::unordered_set<void*> mem_pool; + std::unordered_map<void*, void*> mem_map_; + std::unordered_set<void*> mem_pool_; }; } // namespace tensorrt |