MCPcopy Create free account
hub / github.com/tdrussell/diffusion-pipe / synchronize_device

Function synchronize_device

utils/offloading.py:34–40  ·  view source on GitHub ↗
(device: torch.device)

Source from the content-addressed store, hash-verified

32
33
34def synchronize_device(device: torch.device):
35 if device.type == "cuda":
36 torch.cuda.synchronize()
37 elif device.type == "xpu":
38 torch.xpu.synchronize()
39 elif device.type == "mps":
40 torch.mps.synchronize()
41
42
43def swap_weight_devices_cuda(device: torch.device, layer_to_cpu: nn.Module, layer_to_cuda: nn.Module):

Calls

no outgoing calls

Tested by

no test coverage detected