torch.cuda.change_current_allocator¶ torch.cuda.change_current_allocator(allocator)[源代码]¶ 将当前使用的内存分配器更改为提供的分配器。 如果当前的分配器已经被使用/初始化,此函数将会报错。 Parameters 分配器 (torch.cuda.memory._CUDAAllocator) – 要设置为活动状态的分配器。 注意 有关创建和使用自定义分配器的详细信息,请参阅内存管理