torch.cuda.change_current_allocator¶ torch.cuda.change_current_allocator(allocator)[源][源]¶ 將當前使用的記憶體分配器更改為提供的分配器。 如果當前分配器已被使用或初始化,則此函式將報錯。 引數 allocator (torch.cuda.memory._CUDAAllocator) – 要設定為活動分配器的分配器。 注意 有關建立和使用自定義分配器的詳細資訊,請參閱記憶體管理