Skip to content

Commit 2b193ec

Browse files
authored
[Cherry-pick for 0.17] Fix TestElastic::test_transform on M1 (#8160)
1 parent 2584baa commit 2b193ec

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/test_transforms_v2.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import pickle
88
import random
99
import re
10+
import sys
1011
from copy import deepcopy
1112
from pathlib import Path
1213
from unittest import mock
@@ -2669,11 +2670,15 @@ def test_displacement_error(self, make_input):
26692670
@pytest.mark.parametrize("size", [(163, 163), (72, 333), (313, 95)])
26702671
@pytest.mark.parametrize("device", cpu_and_cuda())
26712672
def test_transform(self, make_input, size, device):
2673+
# We have to skip that test on M1 because it's flaky: Mismatched elements: 35 / 89205 (0.0%)
2674+
# See https://github.com/pytorch/vision/issues/8154
2675+
# All other platforms are fine, so the differences do not come from something we own in torchvision
2676+
check_v1_compatibility = False if sys.platform == "darwin" else dict(rtol=0, atol=1)
2677+
26722678
check_transform(
26732679
transforms.ElasticTransform(),
26742680
make_input(size, device=device),
2675-
# We updated gaussian blur kernel generation with a faster and numerically more stable version
2676-
check_v1_compatibility=dict(rtol=0, atol=1),
2681+
check_v1_compatibility=check_v1_compatibility,
26772682
)
26782683

26792684

0 commit comments

Comments
 (0)