Skip to content

Commit

Permalink
Merge branch 'main' into jafelfeaef
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug authored May 30, 2024
2 parents 04c5571 + b0f9f7b commit 57ac862
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions test/test_transforms_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5203,6 +5203,11 @@ def test_transform(self, make_input, dtype, device):
transforms.LinearTransformation(*self._make_matrix_and_vector(input)),
input,
check_sample_input=self._sample_input_adapter,
# Compat check is failing on M1 with:
# AssertionError: Tensor-likes are not close!
# Mismatched elements: 1 / 561 (0.2%)
# See https://github.com/pytorch/vision/issues/8453
check_v1_compatibility=(sys.platform != "darwin"),
)

def test_transform_error(self):
Expand Down
7 changes: 3 additions & 4 deletions torchvision/io/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def read_video(
Reads a video from a file, returning both the video frames and the audio frames
Args:
filename (str): path to the video file
filename (str): path to the video file. If using the pyav backend, this can be whatever ``av.open`` accepts.
start_pts (int if pts_unit = 'pts', float / Fraction if pts_unit = 'sec', optional):
The start presentation time of the video
end_pts (int if pts_unit = 'pts', float / Fraction if pts_unit = 'sec', optional):
Expand All @@ -267,10 +267,9 @@ def read_video(

from torchvision import get_video_backend

if not os.path.exists(filename):
raise RuntimeError(f"File not found: {filename}")

if get_video_backend() != "pyav":
if not os.path.exists(filename):
raise RuntimeError(f"File not found: {filename}")
vframes, aframes, info = _video_opt._read_video(filename, start_pts, end_pts, pts_unit)
else:
_check_av_available()
Expand Down
4 changes: 2 additions & 2 deletions torchvision/transforms/v2/functional/_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def resize(
# according to our benchmarks on eager, non-AVX CPUs should still prefer u8->f32->interpolate->u8 path for bilinear
def _do_native_uint8_resize_on_cpu(interpolation: InterpolationMode) -> bool:
if interpolation == InterpolationMode.BILINEAR:
if torch._dynamo.is_compiling():
if torch.compiler.is_compiling():
return True
else:
return "AVX2" in torch.backends.cpu.get_cpu_capability()
Expand Down Expand Up @@ -525,7 +525,7 @@ def _get_inverse_affine_matrix(


def _compute_affine_output_size(matrix: List[float], w: int, h: int) -> Tuple[int, int]:
if torch._dynamo.is_compiling() and not torch.jit.is_scripting():
if torch.compiler.is_compiling() and not torch.jit.is_scripting():
return _compute_affine_output_size_python(matrix, w, h)
else:
return _compute_affine_output_size_tensor(matrix, w, h)
Expand Down

0 comments on commit 57ac862

Please sign in to comment.