torch.cuda.change_current_allocator

torch.cuda.change_current_allocator(allocator)[源代码]

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

如果当前的分配器已被使用或初始化,则该函数将报告错误。

参数

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

注意

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

本页目录