SingleDeviceStrategy¶
- class lightning.fabric.strategies.SingleDeviceStrategy(device='cpu', accelerator=None, checkpoint_io=None, precision=None)[source]¶
- Bases: - Strategy- Strategy that handles communication on a single device. - all_gather(tensor, group=None, sync_grads=False)[source]¶
- Perform a - all_gatheron all processes.- Return type:
 
 - all_reduce(tensor, *args, **kwargs)[source]¶
- Reduces a tensor from several distributed processes to one aggregated tensor. As this plugin only operates with a single device, the reduction is simply the identity. - Parameters:
- tensor¶ (Any | torch.Tensor) – the tensor to sync and reduce 
- *args¶ (Any) – ignored 
- **kwargs¶ (Any) – ignored 
 
- Return type:
- Any | torch.Tensor 
- Returns:
- the unmodified input as reduction is not needed for single process operation 
 
 - barrier(*args, **kwargs)[source]¶
- Synchronizes all processes which blocks processes until the whole group enters this function.