Skip to content

Commit aa1cfe5

Browse files
authored
Fixes nightly CI failure (#2039)
* Fixes nightly CI failure * Fixed wrong compare
1 parent d16d15e commit aa1cfe5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/ignite/distributed/test_auto.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from distutils.version import LooseVersion
23

34
import pytest
45
import torch
@@ -165,7 +166,8 @@ def test_auto_methods_gloo(distributed_context_single_node_gloo):
165166
_test_auto_model_optimizer(ws, device)
166167

167168
if ws > 1 and device.type == "cpu":
168-
with pytest.raises(AssertionError, match=r"SyncBatchNorm layers only work with GPU modules"):
169+
error_type = AssertionError if LooseVersion(torch.__version__) <= LooseVersion("1.8.1") else ValueError
170+
with pytest.raises(error_type, match=r"SyncBatchNorm layers only work with GPU modules"):
169171
model = nn.Sequential(nn.Linear(20, 100), nn.BatchNorm1d(100))
170172
auto_model(model, sync_bn=True)
171173

0 commit comments

Comments
 (0)