评价此页

torch.cuda.memory.change_current_allocator#

torch.cuda.memory.change_current_allocator(allocator)[source]#

将当前使用的内存分配器更改为提供的分配器。

如果当前分配器已经被使用/初始化,此函数将出错。

参数

allocator (torch.cuda.memory._CUDAAllocator) – 要设置为活动分配器的分配器。

注意

有关创建和使用自定义分配器的详细信息,请参阅 内存管理