From ef8c0f68789e44d56c1fdeae8f2462050e8b3be3 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Tue, 30 Jul 2024 12:28:47 +0100 Subject: [PATCH] Fix Mypy (#8555) --- torchvision/datasets/kinetics.py | 2 +- torchvision/transforms/_presets.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/torchvision/datasets/kinetics.py b/torchvision/datasets/kinetics.py index 42d32533953..aef61c2442d 100644 --- a/torchvision/datasets/kinetics.py +++ b/torchvision/datasets/kinetics.py @@ -16,7 +16,7 @@ from .vision import VisionDataset -def _dl_wrap(tarpath: str, videopath: str, line: str) -> None: +def _dl_wrap(tarpath: Union[str, Path], videopath: Union[str, Path], line: str) -> None: download_and_extract_archive(line, tarpath, videopath) diff --git a/torchvision/transforms/_presets.py b/torchvision/transforms/_presets.py index d7f88bdb992..fb6f4ad5ca5 100644 --- a/torchvision/transforms/_presets.py +++ b/torchvision/transforms/_presets.py @@ -2,7 +2,7 @@ This file is part of the private API. Please do not use directly these classes as they will be modified on future versions without warning. The classes should be accessed only via the transforms argument of Weights. """ -from typing import Optional, Tuple +from typing import Optional, Tuple, Union import torch from torch import nn, Tensor @@ -87,7 +87,7 @@ def __init__( self, *, crop_size: Tuple[int, int], - resize_size: Tuple[int, int], + resize_size: Union[Tuple[int], Tuple[int, int]], mean: Tuple[float, ...] = (0.43216, 0.394666, 0.37645), std: Tuple[float, ...] = (0.22803, 0.22145, 0.216989), interpolation: InterpolationMode = InterpolationMode.BILINEAR,