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

Function require_torch_multi_accelerator

tests/testing_utils.py:569–582  ·  view source on GitHub ↗

Decorator marking a test that requires a multi-accelerator setup (in PyTorch). These tests are skipped on a machine without multiple hardware accelerators.

(test_case)

Source from the content-addressed store, hash-verified

567
568
569def require_torch_multi_accelerator(test_case):
570 """
571 Decorator marking a test that requires a multi-accelerator setup (in PyTorch). These tests are skipped on a machine
572 without multiple hardware accelerators.
573 """
574 if not is_torch_available():
575 return pytest.mark.skip(reason="test requires PyTorch")(test_case)
576
577 import torch
578
579 return pytest.mark.skipif(
580 not (torch.cuda.device_count() > 1 or torch.xpu.device_count() > 1),
581 reason="test requires multiple hardware accelerators",
582 )(test_case)
583
584
585def require_torch_accelerator_with_fp16(test_case):

Callers

nothing calls this directly

Calls 1

is_torch_availableFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…