MCPcopy Index your code
hub / github.com/huggingface/diffusers / empty_device_cache

Function empty_device_cache

src/diffusers/utils/torch_utils.py:303–309  ·  view source on GitHub ↗
(device_type: str | None = None)

Source from the content-addressed store, hash-verified

301
302
303def empty_device_cache(device_type: str | None = None):
304 if device_type is None:
305 device_type = get_device()
306 if device_type in ["cpu"]:
307 return
308 device_mod = getattr(torch, device_type, torch.cuda)
309 device_mod.empty_cache()
310
311
312def device_synchronize(device_type: str | None = None):

Callers 15

prepare_latentsMethod · 0.85
__call__Method · 0.85
__call__Method · 0.85
__call__Method · 0.85
__call__Method · 0.85
prepare_latentsMethod · 0.85
__call__Method · 0.85
prepare_latentsMethod · 0.85
__call__Method · 0.85

Calls 1

get_deviceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…