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