提交 ccc55a15 编写于 作者: J jrzaurin

adjusting the types so that the library is compatible with the newer version...

adjusting the types so that the library is compatible with the newer version of torch 1.11 and torchvision 0.12
上级 923011ce
......@@ -16,13 +16,13 @@ from typing import (
)
# isort: off
if sys.version_info.minor == 7:
if sys.version_info >= (3, 8):
from typing import Literal
else:
try:
from typing_extensions import Literal
except ModuleNotFoundError:
pass
else:
from typing import Literal # type: ignore[attr-defined, no-redef] # noqa: F811
# isort: on
from pathlib import PosixPath
......@@ -33,7 +33,6 @@ from torch.nn import Module
from torch.optim.optimizer import Optimizer
from torchvision.transforms import (
Pad,
Scale,
Lambda,
Resize,
Compose,
......@@ -46,17 +45,28 @@ from torchvision.transforms import (
RandomCrop,
ToPILImage,
ColorJitter,
PILToTensor,
RandomApply,
RandomOrder,
GaussianBlur,
RandomAffine,
RandomChoice,
RandomInvert,
RandomErasing,
RandomEqualize,
RandomRotation,
RandomSolarize,
RandomGrayscale,
RandomSizedCrop,
RandomPosterize,
ConvertImageDtype,
InterpolationMode,
RandomPerspective,
RandomResizedCrop,
RandomAutocontrast,
RandomVerticalFlip,
LinearTransformation,
RandomHorizontalFlip,
RandomAdjustSharpness,
)
from torch.optim.lr_scheduler import _LRScheduler
from torch.utils.data.dataloader import DataLoader
......@@ -73,31 +83,41 @@ from pytorch_widedeep.bayesian_models._base_bayesian_model import (
ListRules = Collection[Callable[[str], str]]
Tokens = Collection[Collection[str]]
Transforms = Union[
CenterCrop,
ColorJitter,
Pad,
Lambda,
Resize,
Compose,
TenCrop,
FiveCrop,
ToTensor,
Grayscale,
Lambda,
LinearTransformation,
Normalize,
Pad,
RandomAffine,
CenterCrop,
RandomCrop,
ToPILImage,
ColorJitter,
PILToTensor,
RandomApply,
RandomOrder,
GaussianBlur,
RandomAffine,
RandomChoice,
RandomCrop,
RandomInvert,
RandomErasing,
RandomEqualize,
RandomRotation,
RandomSolarize,
RandomGrayscale,
RandomHorizontalFlip,
RandomOrder,
RandomPosterize,
ConvertImageDtype,
InterpolationMode,
RandomPerspective,
RandomResizedCrop,
RandomRotation,
RandomSizedCrop,
RandomAutocontrast,
RandomVerticalFlip,
Resize,
Scale,
TenCrop,
ToPILImage,
ToTensor,
LinearTransformation,
RandomHorizontalFlip,
RandomAdjustSharpness,
]
LRScheduler = _LRScheduler
ModelParams = Generator[Tensor, Tensor, Tensor]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册