device_index
- class torch.accelerator.device_index(device, /)
Context manager to set the current device index for the current accelerator. Temporarily changes the current device index to the specified value for the duration of the context, and automatically restores the previous device index when exiting the context.
- Parameters:
device (Optional) – a given device index to temporarily set. If None, no device index switching occurs.