Skip to content

[Cherry-pick for 0.17] Fix TestElastic::test_transform on M1 #8160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2023
Merged
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
9 changes: 7 additions & 2 deletions test/test_transforms_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pickle
import random
import re
import sys
from copy import deepcopy
from pathlib import Path
from unittest import mock
Expand Down Expand Up @@ -2669,11 +2670,15 @@ def test_displacement_error(self, make_input):
@pytest.mark.parametrize("size", [(163, 163), (72, 333), (313, 95)])
@pytest.mark.parametrize("device", cpu_and_cuda())
def test_transform(self, make_input, size, device):
# We have to skip that test on M1 because it's flaky: Mismatched elements: 35 / 89205 (0.0%)
# See https://github.com/pytorch/vision/issues/8154
# All other platforms are fine, so the differences do not come from something we own in torchvision
check_v1_compatibility = False if sys.platform == "darwin" else dict(rtol=0, atol=1)

check_transform(
transforms.ElasticTransform(),
make_input(size, device=device),
# We updated gaussian blur kernel generation with a faster and numerically more stable version
check_v1_compatibility=dict(rtol=0, atol=1),
check_v1_compatibility=check_v1_compatibility,
)


Expand Down