| 266 | } |
| 267 | |
| 268 | TensorPoolAllocator::VirtualBuffer::VirtualBuffer( |
| 269 | std::vector<VirtualAllocBlock*>& vblocks, |
| 270 | TensorPoolAllocator* tp) { |
| 271 | for (auto vblock : vblocks) { |
| 272 | auto bin_index = vblock->BinIndex(); |
| 273 | auto internal_bin = tp->GetBin(bin_index); |
| 274 | if (internal_bin == nullptr) { |
| 275 | LOG(WARNING) << "logic error or not allocate correctly"; |
| 276 | } |
| 277 | internal_bins_.emplace(internal_bin); |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | std::pair<void*, TensorPoolAllocator::Bin*> |
| 282 | TensorPoolAllocator::VirtualBuffer::Allocate() { |