set_multithreading_enabled
- class torch.autograd.grad_mode.set_multithreading_enabled(mode)
Context-manager that enables or disables multithreaded backward.
Ordinarily, when accelerator devices are in use, the backward pass runs on device-specific worker threads. The engine creates these threads based on the number of available devices and reuses them across iterations.
When
mode=False, the backward pass runs on the calling thread instead.restores the default behavior.