MemPool¶
- class torch.cuda.MemPool(*args, **kwargs)[source][source]¶
MemPool 表示缓存分配器中的一个内存池。目前,它只是 CUDACachingAllocator 中维护的内存池对象的 ID。
- 参数
allocator (torch._C._cuda_CUDAAllocator, 可选) – 一个 torch._C._cuda_CUDAAllocator 对象,可用于定义内存如何在池中分配。如果
allocator
为None
(默认),内存分配将遵循 CUDACachingAllocator 的默认/当前配置。