Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions ignite/metrics/metric.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import warnings
from abc import ABCMeta, abstractmethod
from collections.abc import Mapping
from functools import wraps
Expand Down Expand Up @@ -210,17 +209,6 @@ def __init__(
):
self._output_transform = output_transform

# Check device if distributed is initialized:
if idist.get_world_size() > 1:

# check if reset and update methods are decorated. Compute may not be decorated
if not (hasattr(self.reset, "_decorated") and hasattr(self.update, "_decorated")):
warnings.warn(
f"{self.__class__.__name__} class does not support distributed setting. "
"Computed result is not collected across all computing devices",
RuntimeWarning,
)

# Some metrics have a large performance regression when run on XLA devices, so for now, we disallow it.
if torch.device(device).type == "xla":
raise ValueError("Cannot create metric on an XLA device. Use device='cpu' instead.")
Expand Down
9 changes: 0 additions & 9 deletions tests/ignite/metrics/test_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ def update(self, output):
assert output == self.true_output


@pytest.mark.distributed
@pytest.mark.skipif("WORLD_SIZE" not in os.environ, reason="Skip if WORLD_SIZE not in env vars")
@pytest.mark.skipif(torch.cuda.is_available(), reason="Skip if GPU")
def test_metric_warning(distributed_context_single_node_gloo):
y = torch.tensor([1.0])
with pytest.warns(RuntimeWarning, match=r"DummyMetric1 class does not support distributed setting"):
DummyMetric1((y, y))


def test_no_transform():
y_pred = torch.Tensor([[2.0], [-2.0]])
y = torch.zeros(2)
Expand Down