16031aae96
CPU tests Workflow / Testing (ubuntu-latest, 3.12) (push) Failing after 1s
CPU tests Workflow / Testing (ubuntu-latest, 3.13) (push) Failing after 0s
Mypy Type Check / Type Check (push) Failing after 0s
Docs/Test WorkFlow / Test docs build (push) Failing after 1s
PR Conflict Labeler / labeling (push) Failing after 1s
Dependency resolution / Resolve [tflite] extra — Python 3.12 (push) Failing after 0s
Smoke Tests / try-all-models (ubuntu-latest, 3.10) (push) Failing after 0s
Smoke Tests / try-all-models (ubuntu-latest, 3.13) (push) Failing after 1s
CPU tests Workflow / build-pkg (push) Failing after 1s
CPU tests Workflow / Testing (ubuntu-latest, 3.10) (push) Failing after 0s
CPU tests Workflow / Testing (ubuntu-latest, 3.11) (push) Failing after 0s
Smoke Tests / try-all-models (macos-latest, 3.10) (push) Has been cancelled
Smoke Tests / try-all-models (macos-latest, 3.13) (push) Has been cancelled
Smoke Tests / try-all-models (windows-latest, 3.10) (push) Has been cancelled
Smoke Tests / try-all-models (windows-latest, 3.13) (push) Has been cancelled
CPU tests Workflow / Testing (macos-latest, 3.10) (push) Has been cancelled
CPU tests Workflow / Testing (macos-latest, 3.13) (push) Has been cancelled
CPU tests Workflow / Testing (windows-latest, 3.10) (push) Has been cancelled
CPU tests Workflow / Testing (windows-latest, 3.13) (push) Has been cancelled
CPU tests Workflow / testing-guardian (push) Has been cancelled
GPU tests Workflow / Testing (push) Has been cancelled
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
# ------------------------------------------------------------------------
|
|
# RF-DETR
|
|
# Copyright (c) 2025 Roboflow. All Rights Reserved.
|
|
# Licensed under the Apache License, Version 2.0 [see LICENSE for details]
|
|
# ------------------------------------------------------------------------
|
|
"""Tests for distributed utility helpers."""
|
|
|
|
from unittest.mock import patch
|
|
|
|
from rfdetr.utilities.distributed import all_gather
|
|
|
|
|
|
def test_all_gather_supports_cpu_without_tensor_truthiness_error() -> None:
|
|
"""all_gather should work on CPU-only setups and return gathered objects."""
|
|
|
|
def _fake_all_gather(output_tensors, input_tensor) -> None:
|
|
for out in output_tensors:
|
|
out.copy_(input_tensor)
|
|
|
|
with (
|
|
patch("rfdetr.utilities.distributed.get_world_size", return_value=2),
|
|
patch("rfdetr.utilities.distributed.dist.all_gather", side_effect=_fake_all_gather),
|
|
patch("rfdetr.utilities.distributed.torch.cuda.is_available", return_value=False),
|
|
):
|
|
result = all_gather({"value": 7})
|
|
|
|
assert result == [{"value": 7}, {"value": 7}]
|