id
int64
0
328k
repository_name
stringlengths
7
58
file_path
stringlengths
9
302
class_name
stringlengths
5
256
human_written_code
stringlengths
16
2.16M
class_skeleton
stringlengths
18
1.49M
⌀
total_program_units
int64
1
1.76k
total_doc_str
int64
0
771
AvgCountLine
float64
0
7.89k
AvgCountLineBlank
float64
0
297
AvgCountLineCode
float64
0
7.89k
AvgCountLineComment
float64
0
7.89k
AvgCyclomatic
float64
0
130
CommentToCodeRatio
float64
0
168
CountClassBase
float64
0
40
CountClassCoupled
float64
0
583
CountClassCoupledModified
float64
0
575
CountClassDerived
float64
0
5.35k
CountDeclInstanceMethod
float64
0
529
CountDeclInstanceVariable
float64
0
296
CountDeclMethod
float64
0
599
CountDeclMethodAll
float64
0
1.12k
CountLine
float64
1
40.4k
CountLineBlank
float64
0
8.16k
CountLineCode
float64
1
25.7k
CountLineCodeDecl
float64
1
8.15k
CountLineCodeExe
float64
0
24.2k
CountLineComment
float64
0
16.5k
CountStmt
float64
1
9.71k
CountStmtDecl
float64
1
8.15k
CountStmtExe
float64
0
9.69k
MaxCyclomatic
float64
0
759
MaxInheritanceTree
float64
0
16
MaxNesting
float64
0
34
SumCyclomatic
float64
0
2.9k
18,600
pytorch/vision
pytorch_vision/torchvision/prototype/models/depth/stereo/raft_stereo.py
torchvision.prototype.models.depth.stereo.raft_stereo.MaskPredictor
import torchvision.models.optical_flow.raft as raft import torch.nn as nn from torchvision.ops import Conv2dNormActivation class MaskPredictor(raft.MaskPredictor): """Mask predictor to be used when upsampling the predicted disparity.""" def __init__(self, *, in_channels: int, hidden_size: int, out_channels: i...
class MaskPredictor(raft.MaskPredictor): '''Mask predictor to be used when upsampling the predicted disparity.''' def __init__(self, *, in_channels: int, hidden_size: int, out_channels: int, multiplier: float=0.25): pass
2
1
5
0
5
0
1
0.33
1
4
1
0
1
3
1
13
9
1
6
5
4
2
6
5
4
1
2
0
1
18,601
pytorch/vision
pytorch_vision/torchvision/prototype/models/depth/stereo/raft_stereo.py
torchvision.prototype.models.depth.stereo.raft_stereo.MultiLevelContextEncoder
from torchvision.models.optical_flow.raft import FlowHead, MotionEncoder, ResidualBlock from typing import Callable, Optional import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor class MultiLevelContextEncoder(nn.Module): """Context Encoder for Raft-Stereo (see paper section ...
class MultiLevelContextEncoder(nn.Module): '''Context Encoder for Raft-Stereo (see paper section 3.1) that may have shared weight with the Feature Encoder. The ContextEncoder takes left image as input, and it outputs concatenated hidden_states and contexts. In Raft-Stereo we have multi level GRUs and this ...
5
1
12
0
11
0
2
0.3
1
6
1
0
4
4
4
14
66
6
46
21
35
14
25
15
20
2
1
1
7
18,602
pytorch/vision
pytorch_vision/torchvision/prototype/models/depth/stereo/raft_stereo.py
torchvision.prototype.models.depth.stereo.raft_stereo.MultiLevelUpdateBlock
from torch import Tensor import torch.nn.functional as F import torch import torch.nn as nn from torchvision.models.optical_flow.raft import FlowHead, MotionEncoder, ResidualBlock class MultiLevelUpdateBlock(nn.Module): """The update block which contains the motion encoder and grus It must expose a ``hidden_d...
class MultiLevelUpdateBlock(nn.Module): '''The update block which contains the motion encoder and grus It must expose a ``hidden_dims`` attribute which is the hidden dimension size of its gru blocks ''' def __init__(self, *, motion_encoder: MotionEncoder, hidden_dims: list[int]): pass def...
3
1
33
4
22
8
5
0.4
1
10
2
0
2
3
2
12
73
10
45
20
35
18
24
13
21
5
1
3
9
18,603
pytorch/vision
pytorch_vision/torchvision/prototype/models/depth/stereo/raft_stereo.py
torchvision.prototype.models.depth.stereo.raft_stereo.RaftStereo
from torchvision.utils import _log_api_usage_once from torch import Tensor from torchvision.models.optical_flow._utils import grid_sample, make_coords_grid, upsample_flow import torch import torch.nn as nn import torch.nn.functional as F from typing import Callable, Optional class RaftStereo(nn.Module): def __ini...
class RaftStereo(nn.Module): def __init__(self, *, feature_encoder: FeatureEncoder, context_encoder: MultiLevelContextEncoder, corr_pyramid: CorrPyramid1d, corr_block: CorrBlock1d, update_block: MultiLevelUpdateBlock, disparity_head: nn.Module, mask_predictor: Optional[nn.Module]=None, slow_fast: bool=False): ...
3
2
78
10
45
25
4
0.54
1
11
5
0
2
12
2
12
158
20
91
50
75
49
57
37
54
7
1
3
8
18,604
pytorch/vision
pytorch_vision/torchvision/prototype/models/depth/stereo/raft_stereo.py
torchvision.prototype.models.depth.stereo.raft_stereo.Raft_Stereo_Base_Weights
from torchvision.models._api import register_model, Weights, WeightsEnum from functools import partial from torchvision.prototype.transforms._presets import StereoMatching class Raft_Stereo_Base_Weights(WeightsEnum): SCENEFLOW_V1 = Weights(url='https://download.pytorch.org/models/raft_stereo_base_sceneflow-eff3f2e...
class Raft_Stereo_Base_Weights(WeightsEnum): pass
1
0
0
0
0
0
0
0.19
1
0
0
0
0
0
0
55
72
3
58
5
57
11
5
5
4
0
5
0
0
18,605
pytorch/vision
pytorch_vision/torchvision/prototype/models/depth/stereo/raft_stereo.py
torchvision.prototype.models.depth.stereo.raft_stereo.Raft_Stereo_Realtime_Weights
from torchvision.models._api import register_model, Weights, WeightsEnum from functools import partial from torchvision.prototype.transforms._presets import StereoMatching class Raft_Stereo_Realtime_Weights(WeightsEnum): SCENEFLOW_V1 = Weights(url='https://download.pytorch.org/models/raft_stereo_realtime-cf345ccb....
class Raft_Stereo_Realtime_Weights(WeightsEnum): pass
1
0
0
0
0
0
0
0.13
1
0
0
0
0
0
0
55
18
1
15
3
14
2
3
3
2
0
5
0
0
18,606
pytorch/vision
pytorch_vision/torchvision/prototype/transforms/_augment.py
torchvision.prototype.transforms._augment.SimpleCopyPaste
from torchvision.ops import masks_to_boxes from torch.utils._pytree import tree_flatten, tree_unflatten from typing import Any, cast, Optional, Union from torchvision.prototype import tv_tensors as proto_tv_tensors from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform from torchvision impo...
class SimpleCopyPaste(Transform): def __init__(self, blending: bool=True, resize_interpolation: Union[int, InterpolationMode]=F.InterpolationMode.BILINEAR, antialias: Optional[bool]=None) -> None: pass def _copy_paste(self, image: Union[torch.Tensor, tv_tensors.Image], target: dict[str, Any], paste_i...
6
0
37
5
27
5
5
0.17
1
15
5
0
5
3
5
26
191
30
138
62
110
23
90
40
84
9
2
2
26
18,607
pytorch/vision
pytorch_vision/torchvision/prototype/transforms/_geometry.py
torchvision.prototype.transforms._geometry.FixedSizeCrop
import torch from typing import Any, Optional, Union import PIL.Image from torchvision import tv_tensors from torchvision.prototype.tv_tensors import Label, OneHotLabel from torchvision.transforms.v2._utils import _FillType, _get_fill, _setup_fill_arg, _setup_size, get_bounding_boxes, has_any, is_pure_tensor, query_siz...
class FixedSizeCrop(Transform): def __init__(self, size: Union[int, Sequence[int]], fill: Union[_FillType, dict[Union[type, str], _FillType]]=0, padding_mode: str='constant') -> None: pass def check_inputs(self, flat_inputs: list[Any]) -> None: pass def make_params(self, flat_inputs: lis...
5
0
28
4
24
0
3
0
1
17
7
0
4
5
4
25
114
17
97
31
87
0
51
26
46
6
2
2
13
18,608
pytorch/vision
pytorch_vision/torchvision/prototype/transforms/_misc.py
torchvision.prototype.transforms._misc.PermuteDimensions
from torchvision import tv_tensors import warnings from typing import Any, Optional, TypeVar, Union from torchvision.transforms.v2._utils import is_pure_tensor from collections.abc import Sequence from torchvision.transforms.v2 import Transform import torch class PermuteDimensions(Transform): _transformed_types = ...
class PermuteDimensions(Transform): def __init__(self, dims: Union[Sequence[int], dict[type, Optional[Sequence[int]]]]) -> None: pass def transform(self, inpt: Any, params: dict[str, Any]) -> torch.Tensor: pass
3
0
8
0
8
0
3
0
1
9
2
0
2
1
2
23
20
2
18
6
15
0
14
6
11
3
2
1
5
18,609
pytorch/vision
pytorch_vision/torchvision/prototype/transforms/_misc.py
torchvision.prototype.transforms._misc.TransposeDimensions
from torchvision import tv_tensors import torch from torchvision.transforms.v2._utils import is_pure_tensor from typing import Any, Optional, TypeVar, Union import warnings from torchvision.transforms.v2 import Transform class TransposeDimensions(Transform): _transformed_types = (is_pure_tensor, tv_tensors.Image, ...
class TransposeDimensions(Transform): def __init__(self, dims: Union[tuple[int, int], dict[type, Optional[tuple[int, int]]]]) -> None: pass def transform(self, inpt: Any, params: dict[str, Any]) -> torch.Tensor: pass
3
0
8
0
8
0
3
0
1
9
2
0
2
1
2
23
20
2
18
6
15
0
14
6
11
3
2
1
5
18,610
pytorch/vision
pytorch_vision/torchvision/prototype/transforms/_presets.py
torchvision.prototype.transforms._presets.StereoMatching
from torchvision.transforms.v2 import functional as F, InterpolationMode from typing import Optional, Union import PIL.Image from torch import Tensor from torchvision.transforms.v2.functional._geometry import _check_interpolation import torch class StereoMatching(torch.nn.Module): def __init__(self, *, use_gray_s...
class StereoMatching(torch.nn.Module): def __init__(self, *, use_gray_scale: bool=False, resize_size: Optional[tuple[int, ...]], mean: tuple[float, ...]=(0.5, 0.5, 0.5), std: pass def forward(self, left_image: Tensor, right_image: Tensor) -> tuple[Tensor, Tensor]: pass def _process_i...
6
0
15
1
12
2
2
0.1
1
8
1
0
4
5
4
14
62
7
50
20
36
5
36
12
30
4
1
1
9
18,611
pytorch/vision
pytorch_vision/torchvision/prototype/transforms/_type_conversion.py
torchvision.prototype.transforms._type_conversion.LabelToOneHot
from typing import Any from torchvision.transforms.v2 import Transform from torchvision.prototype import tv_tensors as proto_tv_tensors import torch from torch.nn.functional import one_hot class LabelToOneHot(Transform): _transformed_types = (proto_tv_tensors.Label,) def __init__(self, num_categories: int=-1)...
class LabelToOneHot(Transform): def __init__(self, num_categories: int=-1): pass def transform(self, inpt: proto_tv_tensors.Label, params: dict[str, Any]) -> proto_tv_tensors.OneHotLabel: pass def extra_repr(self) -> str: pass
4
0
5
0
4
0
2
0
1
5
0
0
3
1
3
24
19
4
15
8
11
0
15
8
11
2
2
1
5
18,612
pytorch/vision
pytorch_vision/torchvision/prototype/tv_tensors/_label.py
torchvision.prototype.tv_tensors._label.Label
from typing import Any, TypeVar from torch.utils._pytree import tree_map class Label(_LabelBase): def to_categories(self) -> Any: if self.categories is None: raise RuntimeError('Label does not have categories') return tree_map(lambda idx: self.categories[idx], self.tolist())
class Label(_LabelBase): def to_categories(self) -> Any: pass
2
0
5
1
4
1
2
0.2
1
2
0
0
1
0
1
72
6
1
5
2
3
1
5
2
3
2
4
1
2
18,613
pytorch/vision
pytorch_vision/torchvision/prototype/tv_tensors/_label.py
torchvision.prototype.tv_tensors._label.OneHotLabel
from collections.abc import Sequence from typing import Any, TypeVar import torch class OneHotLabel(_LabelBase): def __new__(cls, data: Any, *, categories: Sequence[str] | None=None, dtype: torch.dtype | None=None, device: torch.device | str | int | None=None, requires_grad: bool=False) -> OneHotLabel: on...
class OneHotLabel(_LabelBase): def __new__(cls, data: Any, *, categories: Sequence[str] | None=None, dtype: torch.dtype | None=None, device: torch.device | str | int | None=None, requires_grad: bool=False) -> OneHotLabel: pass
2
0
17
2
15
0
2
0
1
6
0
0
1
0
1
72
18
2
16
11
6
0
6
3
4
2
4
1
2
18,614
pytorch/vision
pytorch_vision/torchvision/prototype/tv_tensors/_label.py
torchvision.prototype.tv_tensors._label._LabelBase
from typing import Any, TypeVar import torch from collections.abc import Sequence from torchvision.tv_tensors._tv_tensor import TVTensor class _LabelBase(TVTensor): categories: Sequence[str] | None @classmethod def _wrap(cls: type[L], tensor: torch.Tensor, *, categories: Sequence[str] | None) -> L: ...
class _LabelBase(TVTensor): @classmethod def _wrap(cls: type[L], tensor: torch.Tensor, *, categories: Sequence[str] | None) -> L: pass def __new__(cls: type[L], data: Any, *, categories: Sequence[str] | None=None, dtype: torch.dtype | None=None, device: torch.device | str | int | None=None, requi...
6
0
8
0
8
0
1
0
1
4
0
2
1
0
3
71
30
3
27
22
7
0
11
6
7
1
3
0
3
18,615
pytorch/vision
pytorch_vision/torchvision/prototype/utils/_internal.py
torchvision.prototype.utils._internal.ReadOnlyTensorBuffer
import io import torch class ReadOnlyTensorBuffer: def __init__(self, tensor: torch.Tensor) -> None: self._memory = memoryview(tensor.numpy()) self._cursor: int = 0 def tell(self) -> int: return self._cursor def seek(self, offset: int, whence: int=io.SEEK_SET) -> int: if ...
class ReadOnlyTensorBuffer: def __init__(self, tensor: torch.Tensor) -> None: pass def tell(self) -> int: pass def seek(self, offset: int, whence: int=io.SEEK_SET) -> int: pass def read(self, size: int=-1) -> bytes: pass
5
0
6
0
6
0
2
0.04
0
6
0
0
4
2
4
4
27
3
24
9
19
1
18
9
13
4
0
1
8
18,616
pytorch/vision
pytorch_vision/torchvision/transforms/_presets.py
torchvision.transforms._presets.ImageClassification
from torch import nn, Tensor from typing import Optional, Union from . import functional as F, InterpolationMode import torch class ImageClassification(nn.Module): def __init__(self, *, crop_size: int, resize_size: int=256, mean: tuple[float, ...]=(0.485, 0.456, 0.406), std: tuple[float, ...]=(0.229, 0.224, 0.225...
class ImageClassification(nn.Module): def __init__(self, *, crop_size: int, resize_size: int=256, mean: tuple[float, ...]=(0.485, 0.456, 0.406), std: pass def forward(self, img: Tensor) -> Tensor: pass def __repr__(self) -> str: pass def describe(self) -> str: pass
5
0
10
0
10
0
1
0
1
8
1
0
4
6
4
14
45
3
42
21
28
0
28
12
23
2
1
1
5
18,617
pytorch/vision
pytorch_vision/torchvision/transforms/_presets.py
torchvision.transforms._presets.ObjectDetection
from torch import nn, Tensor from . import functional as F, InterpolationMode import torch class ObjectDetection(nn.Module): def forward(self, img: Tensor) -> Tensor: if not isinstance(img, Tensor): img = F.pil_to_tensor(img) return F.convert_image_dtype(img, torch.float) def __re...
class ObjectDetection(nn.Module): def forward(self, img: Tensor) -> Tensor: pass def __repr__(self) -> str: pass def describe(self) -> str: pass
4
0
4
0
4
0
1
0
1
3
0
0
3
0
3
13
14
2
12
4
8
0
9
4
5
2
1
1
4
18,618
pytorch/vision
pytorch_vision/torchvision/transforms/_presets.py
torchvision.transforms._presets.OpticalFlow
from . import functional as F, InterpolationMode from torch import nn, Tensor import torch class OpticalFlow(nn.Module): def forward(self, img1: Tensor, img2: Tensor) -> tuple[Tensor, Tensor]: if not isinstance(img1, Tensor): img1 = F.pil_to_tensor(img1) if not isinstance(img2, Tensor)...
class OpticalFlow(nn.Module): def forward(self, img1: Tensor, img2: Tensor) -> tuple[Tensor, Tensor]: pass def __repr__(self) -> str: pass def describe(self) -> str: pass
4
0
8
1
6
0
2
0.05
1
3
0
0
3
0
3
13
27
6
20
4
16
1
17
4
13
3
1
1
5
18,619
pytorch/vision
pytorch_vision/torchvision/transforms/_presets.py
torchvision.transforms._presets.SemanticSegmentation
from . import functional as F, InterpolationMode from torch import nn, Tensor from typing import Optional, Union import torch class SemanticSegmentation(nn.Module): def __init__(self, *, resize_size: Optional[int], mean: tuple[float, ...]=(0.485, 0.456, 0.406), std: tuple[float, ...]=(0.229, 0.224, 0.225), interp...
class SemanticSegmentation(nn.Module): def __init__(self, *, resize_size: Optional[int], mean: tuple[float, ...]=(0.485, 0.456, 0.406), std: pass def forward(self, img: Tensor) -> Tensor: pass def __repr__(self) -> str: pass def describe(self) -> str: pass
5
0
10
0
10
0
2
0
1
8
1
0
4
5
4
14
42
3
39
19
26
0
26
11
21
3
1
1
7
18,620
pytorch/vision
pytorch_vision/torchvision/transforms/_presets.py
torchvision.transforms._presets.VideoClassification
import torch from torch import nn, Tensor from typing import Optional, Union from . import functional as F, InterpolationMode class VideoClassification(nn.Module): def __init__(self, *, crop_size: tuple[int, int], resize_size: Union[tuple[int], tuple[int, int]], mean: tuple[float, ...]=(0.43216, 0.394666, 0.37645...
class VideoClassification(nn.Module): def __init__(self, *, crop_size: tuple[int, int], resize_size: Union[tuple[int], tuple[int, int]], mean: tuple[float, ...]=(0.43216, 0.394666, 0.37645), std: pass def forward(self, vid: Tensor) -> Tensor: pass def __repr__(self) -> str: pass ...
5
0
14
1
12
1
2
0.1
1
7
1
0
4
5
4
14
59
5
50
21
37
5
36
13
31
3
1
1
6
18,621
pytorch/vision
pytorch_vision/torchvision/transforms/_transforms_video.py
torchvision.transforms._transforms_video.CenterCropVideo
from . import _functional_video as F import numbers class CenterCropVideo: def __init__(self, crop_size): if isinstance(crop_size, numbers.Number): self.crop_size = (int(crop_size), int(crop_size)) else: self.crop_size = crop_size def __call__(self, clip): """ ...
class CenterCropVideo: def __init__(self, crop_size): pass def __call__(self, clip): ''' Args: clip (torch.tensor): Video clip to be cropped. Size is (C, T, H, W) Returns: torch.tensor: central cropping of video clip. Size is (C, T, crop_siz...
4
1
5
0
3
2
1
0.7
0
3
0
0
3
1
3
3
19
2
10
5
6
7
9
5
5
2
0
1
4
18,622
pytorch/vision
pytorch_vision/torchvision/transforms/_transforms_video.py
torchvision.transforms._transforms_video.NormalizeVideo
from . import _functional_video as F class NormalizeVideo: """ Normalize the video clip by mean subtraction and division by standard deviation Args: mean (3-tuple): pixel RGB mean std (3-tuple): pixel RGB standard deviation inplace (boolean): whether do in-place normalization ""...
class NormalizeVideo: ''' Normalize the video clip by mean subtraction and division by standard deviation Args: mean (3-tuple): pixel RGB mean std (3-tuple): pixel RGB standard deviation inplace (boolean): whether do in-place normalization ''' def __init__(self, mean, std, ...
4
2
4
0
3
1
1
1.22
0
1
0
0
3
3
3
3
23
3
9
7
5
11
9
7
5
1
0
0
3
18,623
pytorch/vision
pytorch_vision/torchvision/transforms/_transforms_video.py
torchvision.transforms._transforms_video.RandomCropVideo
from torchvision.transforms import RandomCrop, RandomResizedCrop import numbers from . import _functional_video as F class RandomCropVideo(RandomCrop): def __init__(self, size): if isinstance(size, numbers.Number): self.size = (int(size), int(size)) else: self.size = size ...
class RandomCropVideo(RandomCrop): def __init__(self, size): pass def __call__(self, clip): ''' Args: clip (torch.tensor): Video clip to be cropped. Size is (C, T, H, W) Returns: torch.tensor: randomly cropped/resized video clip. size is...
4
1
6
0
3
2
1
0.64
1
3
0
0
3
1
3
17
20
2
11
6
7
7
10
6
6
2
2
1
4
18,624
pytorch/vision
pytorch_vision/torchvision/transforms/_transforms_video.py
torchvision.transforms._transforms_video.RandomHorizontalFlipVideo
from . import _functional_video as F import random class RandomHorizontalFlipVideo: """ Flip the video clip along the horizontal direction with a given probability Args: p (float): probability of the clip being flipped. Default value is 0.5 """ def __init__(self, p=0.5): self.p = p...
class RandomHorizontalFlipVideo: ''' Flip the video clip along the horizontal direction with a given probability Args: p (float): probability of the clip being flipped. Default value is 0.5 ''' def __init__(self, p=0.5): pass def __call__(self, clip): ''' Args:...
4
2
5
0
3
2
1
1.22
0
1
0
0
3
1
3
3
23
3
9
5
5
11
9
5
5
2
0
1
4
18,625
pytorch/vision
pytorch_vision/torchvision/transforms/_transforms_video.py
torchvision.transforms._transforms_video.RandomResizedCropVideo
from . import _functional_video as F from torchvision.transforms import RandomCrop, RandomResizedCrop class RandomResizedCropVideo(RandomResizedCrop): def __init__(self, size, scale=(0.08, 1.0), ratio=(3.0 / 4.0, 4.0 / 3.0), interpolation_mode='bilinear'): if isinstance(size, tuple): if len(si...
class RandomResizedCropVideo(RandomResizedCrop): def __init__(self, size, scale=(0.08, 1.0), ratio=(3.0 / 4.0, 4.0 / 3.0), interpolation_mode='bilinear'): pass def __call__(self, clip): ''' Args: clip (torch.tensor): Video clip to be cropped. Size is (C, T, H, W) R...
4
1
10
0
7
2
2
0.32
1
3
0
0
3
4
3
17
32
3
22
15
12
7
15
9
11
3
2
2
5
18,626
pytorch/vision
pytorch_vision/torchvision/transforms/_transforms_video.py
torchvision.transforms._transforms_video.ToTensorVideo
from . import _functional_video as F class ToTensorVideo: """ Convert tensor data type from uint8 to float, divide value by 255.0 and permute the dimensions of clip tensor """ def __init__(self): pass def __call__(self, clip): """ Args: clip (torch.tensor, ...
class ToTensorVideo: ''' Convert tensor data type from uint8 to float, divide value by 255.0 and permute the dimensions of clip tensor ''' def __init__(self): pass def __call__(self, clip): ''' Args: clip (torch.tensor, dtype=torch.uint8): Size is (T, H, W,...
4
2
4
0
2
2
1
1.43
0
1
0
0
3
0
3
3
20
3
7
4
3
10
7
4
3
1
0
0
3
18,627
pytorch/vision
pytorch_vision/torchvision/transforms/autoaugment.py
torchvision.transforms.autoaugment.AugMix
from typing import Optional import torch from torch import Tensor from . import functional as F, InterpolationMode class AugMix(torch.nn.Module): """AugMix data augmentation method based on `"AugMix: A Simple Data Processing Method to Improve Robustness and Uncertainty" <https://arxiv.org/abs/1912.02781>`_. ...
class AugMix(torch.nn.Module): '''AugMix data augmentation method based on `"AugMix: A Simple Data Processing Method to Improve Robustness and Uncertainty" <https://arxiv.org/abs/1912.02781>`_. If the image is torch Tensor, it should be of type torch.uint8, and it is expected to have [..., 1 or 3, H, W...
10
2
17
1
15
1
3
0.26
1
10
1
0
7
8
7
17
150
15
107
47
88
28
59
36
51
10
1
3
18
18,628
pytorch/vision
pytorch_vision/torchvision/transforms/autoaugment.py
torchvision.transforms.autoaugment.AutoAugment
from . import functional as F, InterpolationMode import torch from typing import Optional from torch import Tensor class AutoAugment(torch.nn.Module): """AutoAugment data augmentation method based on `"AutoAugment: Learning Augmentation Strategies from Data" <https://arxiv.org/pdf/1805.09501.pdf>`_. If the...
class AutoAugment(torch.nn.Module): '''AutoAugment data augmentation method based on `"AutoAugment: Learning Augmentation Strategies from Data" <https://arxiv.org/pdf/1805.09501.pdf>`_. If the image is torch Tensor, it should be of type torch.uint8, and it is expected to have [..., 1 or 3, H, W] shape,...
8
3
26
1
24
2
3
0.17
1
10
2
0
5
4
6
16
181
13
144
29
129
24
39
21
32
8
1
3
16
18,629
pytorch/vision
pytorch_vision/torchvision/transforms/autoaugment.py
torchvision.transforms.autoaugment.AutoAugmentPolicy
from enum import Enum class AutoAugmentPolicy(Enum): """AutoAugment policies learned on different datasets. Available policies are IMAGENET, CIFAR10 and SVHN. """ IMAGENET = 'imagenet' CIFAR10 = 'cifar10' SVHN = 'svhn'
class AutoAugmentPolicy(Enum): '''AutoAugment policies learned on different datasets. Available policies are IMAGENET, CIFAR10 and SVHN. ''' pass
1
1
0
0
0
0
0
0.75
1
0
0
0
0
0
0
49
8
1
4
4
3
3
4
4
3
0
4
0
0
18,630
pytorch/vision
pytorch_vision/torchvision/transforms/autoaugment.py
torchvision.transforms.autoaugment.RandAugment
import torch from . import functional as F, InterpolationMode from torch import Tensor from typing import Optional class RandAugment(torch.nn.Module): """RandAugment data augmentation method based on `"RandAugment: Practical automated data augmentation with a reduced search space" <https://arxiv.org/abs/19...
class RandAugment(torch.nn.Module): '''RandAugment data augmentation method based on `"RandAugment: Practical automated data augmentation with a reduced search space" <https://arxiv.org/abs/1909.13719>`_. If the image is torch Tensor, it should be of type torch.uint8, and it is expected to have [.....
5
2
17
1
15
2
3
0.36
1
9
1
0
4
5
4
14
91
8
61
26
49
22
30
19
25
7
1
2
10
18,631
pytorch/vision
pytorch_vision/torchvision/transforms/autoaugment.py
torchvision.transforms.autoaugment.TrivialAugmentWide
from . import functional as F, InterpolationMode import torch from torch import Tensor from typing import Optional class TrivialAugmentWide(torch.nn.Module): """Dataset-independent data-augmentation with TrivialAugment Wide, as described in `"TrivialAugment: Tuning-free Yet State-of-the-Art Data Augmentation" ...
class TrivialAugmentWide(torch.nn.Module): '''Dataset-independent data-augmentation with TrivialAugment Wide, as described in `"TrivialAugment: Tuning-free Yet State-of-the-Art Data Augmentation" <https://arxiv.org/abs/2103.10158>`_. If the image is torch Tensor, it should be of type torch.uint8, and it is...
5
2
16
1
14
2
2
0.33
1
8
1
0
4
3
4
14
84
8
57
21
47
19
26
16
21
6
1
2
9
18,632
pytorch/vision
pytorch_vision/torchvision/transforms/functional.py
torchvision.transforms.functional.InterpolationMode
from enum import Enum class InterpolationMode(Enum): """Interpolation modes Available interpolation methods are ``nearest``, ``nearest-exact``, ``bilinear``, ``bicubic``, ``box``, ``hamming``, and ``lanczos``. """ NEAREST = 'nearest' NEAREST_EXACT = 'nearest-exact' BILINEAR = 'bilinear' ...
class InterpolationMode(Enum): '''Interpolation modes Available interpolation methods are ``nearest``, ``nearest-exact``, ``bilinear``, ``bicubic``, ``box``, ``hamming``, and ``lanczos``. ''' pass
1
1
0
0
0
0
0
0.63
1
0
0
0
0
0
0
49
14
1
8
8
7
5
8
8
7
0
4
0
0
18,633
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.CenterCrop
import torch from ..utils import _log_api_usage_once from . import functional as F class CenterCrop(torch.nn.Module): """Crops the given image at the center. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions. If image size ...
class CenterCrop(torch.nn.Module): '''Crops the given image at the center. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions. If image size is smaller than output size along any edge, image is padded with 0 and then center ...
4
2
5
0
3
2
1
1.67
1
2
0
0
3
1
3
13
29
5
9
5
5
15
9
5
5
1
1
0
3
18,634
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.ColorJitter
import torch import numbers from typing import Optional, Union from . import functional as F from torch import Tensor from ..utils import _log_api_usage_once class ColorJitter(torch.nn.Module): """Randomly change the brightness, contrast, saturation and hue of an image. If the image is torch Tensor, it is expe...
class ColorJitter(torch.nn.Module): '''Randomly change the brightness, contrast, saturation and hue of an image. If the image is torch Tensor, it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions. If img is PIL Image, mode "1", "I", "F" and modes w...
8
3
19
2
13
4
4
0.63
1
9
0
2
4
4
5
15
126
15
68
31
49
43
41
18
35
7
1
2
20
18,635
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.Compose
from ..utils import _log_api_usage_once import torch class Compose: """Composes several transforms together. This transform does not support torchscript. Please, see the note below. Args: transforms (list of ``Transform`` objects): list of transforms to compose. Example: >>> transform...
class Compose: '''Composes several transforms together. This transform does not support torchscript. Please, see the note below. Args: transforms (list of ``Transform`` objects): list of transforms to compose. Example: >>> transforms.Compose([ >>> transforms.CenterCrop(10), ...
4
1
5
0
5
0
2
1.25
0
1
0
0
3
1
3
3
45
9
16
8
12
20
16
8
12
2
0
1
6
18,636
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.ConvertImageDtype
from ..utils import _log_api_usage_once from . import functional as F import torch class ConvertImageDtype(torch.nn.Module): """Convert a tensor image to the given ``dtype`` and scale the values accordingly. This function does not support PIL Image. Args: dtype (torch.dtype): Desired data type of...
class ConvertImageDtype(torch.nn.Module): '''Convert a tensor image to the given ``dtype`` and scale the values accordingly. This function does not support PIL Image. Args: dtype (torch.dtype): Desired data type of the output .. note:: When converting from a smaller to a larger integer ...
3
1
3
0
3
0
1
1.86
1
1
0
0
2
1
2
12
27
7
7
4
4
13
7
4
4
1
1
0
2
18,637
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.ElasticTransform
from collections.abc import Sequence from .functional import _interpolation_modes_from_int, InterpolationMode from . import functional as F from torch import Tensor from ..utils import _log_api_usage_once import torch class ElasticTransform(torch.nn.Module): """Transform a tensor image with elastic transformations...
class ElasticTransform(torch.nn.Module): '''Transform a tensor image with elastic transformations. Given alpha and sigma, it will generate displacement vectors for all pixels based on random offsets. Alpha controls the strength and sigma controls the smoothness of the displacements. The displacemen...
6
2
21
2
17
2
6
0.41
1
11
1
0
3
4
4
14
111
16
68
18
62
28
65
17
60
18
1
3
25
18,638
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.FiveCrop
from ..utils import _log_api_usage_once from . import functional as F import torch class FiveCrop(torch.nn.Module): """Crop the given image into four corners and the central crop. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of leading dime...
class FiveCrop(torch.nn.Module): '''Crop the given image into four corners and the central crop. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions .. Note:: This transform returns a tuple of images and there ma...
4
2
5
0
3
2
1
3.22
1
2
0
0
3
1
3
13
45
7
9
5
5
29
9
5
5
1
1
0
3
18,639
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.GaussianBlur
from collections.abc import Sequence from . import functional as F from torch import Tensor from ..utils import _log_api_usage_once import torch import numbers class GaussianBlur(torch.nn.Module): """Blurs image with randomly chosen Gaussian blur. If the image is torch Tensor, it is expected to have [..., ...
class GaussianBlur(torch.nn.Module): '''Blurs image with randomly chosen Gaussian blur. If the image is torch Tensor, it is expected to have [..., C, H, W] shape, where ... means at most one leading dimension. Args: kernel_size (int or sequence): Size of the Gaussian kernel. sigma (floa...
6
3
11
1
6
3
3
0.93
1
7
0
0
3
2
4
14
64
12
27
11
21
25
24
10
19
7
1
2
10
18,640
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.Grayscale
from ..utils import _log_api_usage_once from . import functional as F import torch class Grayscale(torch.nn.Module): """Convert image to grayscale. If the image is torch Tensor, it is expected to have [..., 3, H, W] shape, where ... means an arbitrary number of leading dimensions Args: num_out...
class Grayscale(torch.nn.Module): '''Convert image to grayscale. If the image is torch Tensor, it is expected to have [..., 3, H, W] shape, where ... means an arbitrary number of leading dimensions Args: num_output_channels (int): (1 or 3) number of channels desired for output image Returns...
4
2
5
0
3
2
1
1.78
1
2
0
0
3
1
3
13
33
8
9
5
5
16
9
5
5
1
1
0
3
18,641
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.Lambda
from ..utils import _log_api_usage_once class Lambda: """Apply a user-defined lambda as a transform. This transform does not support torchscript. Args: lambd (function): Lambda/function to be used for transform. """ def __init__(self, lambd): _log_api_usage_once(self) if not c...
class Lambda: '''Apply a user-defined lambda as a transform. This transform does not support torchscript. Args: lambd (function): Lambda/function to be used for transform. ''' def __init__(self, lambd): pass def __call__(self, img): pass def __repr__(self) -> str: ...
4
1
3
0
3
0
1
0.4
0
3
0
0
3
1
3
3
18
4
10
5
6
4
10
5
6
2
0
1
4
18,642
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.LinearTransformation
from torch import Tensor from ..utils import _log_api_usage_once import torch class LinearTransformation(torch.nn.Module): """Transform a tensor image with a square transformation matrix and a mean_vector computed offline. This transform does not support PIL Image. Given transformation_matrix and mean_...
class LinearTransformation(torch.nn.Module): '''Transform a tensor image with a square transformation matrix and a mean_vector computed offline. This transform does not support PIL Image. Given transformation_matrix and mean_vector, will flatten the torch.*Tensor and subtract mean_vector from it wh...
4
2
21
2
16
2
3
0.42
1
5
0
0
3
2
3
13
83
12
50
12
46
21
29
12
25
5
1
1
9
18,643
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.Normalize
from torch import Tensor from ..utils import _log_api_usage_once from . import functional as F import torch class Normalize(torch.nn.Module): """Normalize a tensor image with mean and standard deviation. This transform does not support PIL Image. Given mean: ``(mean[1],...,mean[n])`` and std: ``(std[1],..,...
class Normalize(torch.nn.Module): '''Normalize a tensor image with mean and standard deviation. This transform does not support PIL Image. Given mean: ``(mean[1],...,mean[n])`` and std: ``(std[1],..,std[n])`` for ``n`` channels, this transform will normalize each channel of the input ``torch.*Tenso...
4
2
6
0
3
2
1
1.73
1
3
0
0
3
3
3
13
37
7
11
7
7
19
11
7
7
1
1
0
3
18,644
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.PILToTensor
from ..utils import _log_api_usage_once from . import functional as F class PILToTensor: """Convert a PIL Image to a tensor of the same type - this does not scale values. This transform does not support torchscript. Converts a PIL Image (H x W x C) to a Tensor of shape (C x H x W). """ def __ini...
class PILToTensor: '''Convert a PIL Image to a tensor of the same type - this does not scale values. This transform does not support torchscript. Converts a PIL Image (H x W x C) to a Tensor of shape (C x H x W). ''' def __init__(self) -> None: pass def __call__(self, pic): ''...
4
2
6
1
2
3
1
1.71
0
1
0
0
3
0
3
3
27
8
7
4
3
12
7
4
3
1
0
0
3
18,645
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.Pad
from collections.abc import Sequence from . import functional as F from ..utils import _log_api_usage_once import torch import numbers class Pad(torch.nn.Module): """Pad the given image on all sides with the given "pad" value. If the image is torch Tensor, it is expected to have [..., H, W] shape, where .....
class Pad(torch.nn.Module): '''Pad the given image on all sides with the given "pad" value. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means at most 2 leading dimensions for mode reflect and symmetric, at most 3 leading dimensions for mode edge, and an arbitra...
4
2
10
2
7
2
2
1.71
1
8
0
0
3
3
3
13
71
14
21
7
17
36
19
7
15
5
1
1
7
18,646
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomAdjustSharpness
from ..utils import _log_api_usage_once from . import functional as F import torch class RandomAdjustSharpness(torch.nn.Module): """Adjust the sharpness of the image randomly with a given probability. If the image is torch Tensor, it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary n...
class RandomAdjustSharpness(torch.nn.Module): '''Adjust the sharpness of the image randomly with a given probability. If the image is torch Tensor, it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions. Args: sharpness_factor (float): How much ...
4
2
6
0
4
2
1
1.17
1
2
0
0
3
2
3
13
31
5
12
6
8
14
12
6
8
2
1
1
4
18,647
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomAffine
from typing import Optional, Union from collections.abc import Sequence from .functional import _interpolation_modes_from_int, InterpolationMode from . import functional as F from torch import Tensor from ..utils import _log_api_usage_once import torch import numbers class RandomAffine(torch.nn.Module): """Random ...
class RandomAffine(torch.nn.Module): '''Random affine transformation of the image keeping center invariant. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions. Args: degrees (sequence or number): Range of degrees to ...
6
3
29
5
22
3
7
0.43
1
10
1
0
3
7
4
14
155
27
90
44
69
39
69
28
64
12
1
3
27
18,648
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomApply
from ..utils import _log_api_usage_once import torch class RandomApply(torch.nn.Module): """Apply randomly a list of transformations with a given probability. .. note:: In order to script the transformation, please use ``torch.nn.ModuleList`` as input instead of list/tuple of transforms as sho...
class RandomApply(torch.nn.Module): '''Apply randomly a list of transformations with a given probability. .. note:: In order to script the transformation, please use ``torch.nn.ModuleList`` as input instead of list/tuple of transforms as shown below: >>> transforms = transforms.RandomAp...
4
1
6
0
6
0
2
0.7
1
2
0
0
3
2
3
13
41
7
20
9
16
14
20
9
16
3
1
1
6
18,649
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomAutocontrast
from ..utils import _log_api_usage_once from . import functional as F import torch class RandomAutocontrast(torch.nn.Module): """Autocontrast the pixels of the given image randomly with a given probability. If the image is torch Tensor, it is expected to have [..., 1 or 3, H, W] shape, where ... means an a...
class RandomAutocontrast(torch.nn.Module): '''Autocontrast the pixels of the given image randomly with a given probability. If the image is torch Tensor, it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions. If img is PIL Image, it is expected to b...
4
2
6
0
3
2
1
1.18
1
2
0
0
3
1
3
13
29
5
11
5
7
13
11
5
7
2
1
1
4
18,650
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomChoice
import random from collections.abc import Sequence class RandomChoice(RandomTransforms): """Apply single transformation randomly picked from a list. This transform does not support torchscript.""" def __init__(self, transforms, p=None): super().__init__(transforms) if p is not None and (not is...
class RandomChoice(RandomTransforms): '''Apply single transformation randomly picked from a list. This transform does not support torchscript.''' def __init__(self, transforms, p=None): pass def __call__(self, *args): pass def __repr__(self) -> str: pass
4
1
3
0
3
0
1
0.09
1
4
0
0
3
2
3
6
15
3
11
6
7
1
11
6
7
2
1
1
4
18,651
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomCrop
from torch import Tensor from ..utils import _log_api_usage_once from . import functional as F import torch class RandomCrop(torch.nn.Module): """Crop the given image at a random location. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of leading...
class RandomCrop(torch.nn.Module): '''Crop the given image at a random location. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions, but if non-constant padding is used, the input is expected to have at most 2 leading dimens...
6
3
15
3
8
4
2
1.5
1
6
0
1
3
5
4
14
106
21
34
18
28
51
33
17
28
4
1
1
9
18,652
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomEqualize
from ..utils import _log_api_usage_once from . import functional as F import torch class RandomEqualize(torch.nn.Module): """Equalize the histogram of the given image randomly with a given probability. If the image is torch Tensor, it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitr...
class RandomEqualize(torch.nn.Module): '''Equalize the histogram of the given image randomly with a given probability. If the image is torch Tensor, it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions. If img is PIL Image, it is expected to be in ...
4
2
6
0
3
2
1
1.18
1
2
0
0
3
1
3
13
29
5
11
5
7
13
11
5
7
2
1
1
4
18,653
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomErasing
from typing import Optional, Union from collections.abc import Sequence import warnings from . import functional as F from torch import Tensor from ..utils import _log_api_usage_once import torch import numbers import math class RandomErasing(torch.nn.Module): """Randomly selects a rectangle region in a torch.Tens...
class RandomErasing(torch.nn.Module): '''Randomly selects a rectangle region in a torch.Tensor image and erases its pixels. This transform does not support PIL Image. 'Random Erasing Data Augmentation' by Zhong et al. See https://arxiv.org/abs/1708.04896 Args: p: probability that the random er...
6
3
26
3
18
5
5
0.58
1
12
0
1
3
5
4
14
134
19
73
27
65
42
56
24
51
8
1
2
19
18,654
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomGrayscale
from ..utils import _log_api_usage_once from . import functional as F import torch class RandomGrayscale(torch.nn.Module): """Randomly convert image to grayscale with a probability of p (default 0.1). If the image is torch Tensor, it is expected to have [..., 3, H, W] shape, where ... means an arbitrary nu...
class RandomGrayscale(torch.nn.Module): '''Randomly convert image to grayscale with a probability of p (default 0.1). If the image is torch Tensor, it is expected to have [..., 3, H, W] shape, where ... means an arbitrary number of leading dimensions Args: p (float): probability that image shou...
4
2
6
0
4
2
1
1.42
1
2
0
0
3
1
3
13
36
7
12
6
8
17
12
6
8
2
1
1
4
18,655
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomHorizontalFlip
from ..utils import _log_api_usage_once from . import functional as F import torch class RandomHorizontalFlip(torch.nn.Module): """Horizontally flip the given image randomly with a given probability. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number...
class RandomHorizontalFlip(torch.nn.Module): '''Horizontally flip the given image randomly with a given probability. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions Args: p (float): probability of the image be...
4
2
6
0
3
2
1
1.18
1
2
0
1
3
1
3
13
29
5
11
5
7
13
11
5
7
2
1
1
4
18,656
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomInvert
from ..utils import _log_api_usage_once from . import functional as F import torch class RandomInvert(torch.nn.Module): """Inverts the colors of the given image randomly with a given probability. If img is a Tensor, it is expected to be in [..., 1 or 3, H, W] format, where ... means it can have an arbitrar...
class RandomInvert(torch.nn.Module): '''Inverts the colors of the given image randomly with a given probability. If img is a Tensor, it is expected to be in [..., 1 or 3, H, W] format, where ... means it can have an arbitrary number of leading dimensions. If img is PIL Image, it is expected to be in mo...
4
2
6
0
3
2
1
1.18
1
2
0
0
3
1
3
13
29
5
11
5
7
13
11
5
7
2
1
1
4
18,657
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomOrder
import random class RandomOrder(RandomTransforms): """Apply a list of transformations in a random order. This transform does not support torchscript.""" def __call__(self, img): order = list(range(len(self.transforms))) random.shuffle(order) for i in order: img = self.trans...
class RandomOrder(RandomTransforms): '''Apply a list of transformations in a random order. This transform does not support torchscript.''' def __call__(self, img): pass
2
1
6
0
6
0
2
0.14
1
2
0
0
1
0
1
4
9
1
7
4
5
1
7
4
5
2
1
1
2
18,658
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomPerspective
from torch import Tensor from ..utils import _log_api_usage_once from .functional import _interpolation_modes_from_int, InterpolationMode import torch import numbers from collections.abc import Sequence from . import functional as F class RandomPerspective(torch.nn.Module): """Performs a random perspective transfo...
class RandomPerspective(torch.nn.Module): '''Performs a random perspective transformation of the given image with a given probability. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions. Args: distortion_scale (float...
6
3
18
2
12
4
3
0.57
1
9
1
0
3
4
4
14
94
14
51
21
45
29
36
20
31
4
1
2
10
18,659
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomPosterize
import torch from . import functional as F from ..utils import _log_api_usage_once class RandomPosterize(torch.nn.Module): """Posterize the image randomly with a given probability by reducing the number of bits for each color channel. If the image is torch Tensor, it should be of type torch.uint8, and it i...
class RandomPosterize(torch.nn.Module): '''Posterize the image randomly with a given probability by reducing the number of bits for each color channel. If the image is torch Tensor, it should be of type torch.uint8, and it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number o...
4
2
6
0
4
2
1
1.17
1
2
0
0
3
2
3
13
31
5
12
6
8
14
12
6
8
2
1
1
4
18,660
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomResizedCrop
from torch import Tensor from ..utils import _log_api_usage_once import torch import math from typing import Optional, Union from .functional import _interpolation_modes_from_int, InterpolationMode from collections.abc import Sequence from . import functional as F import warnings class RandomResizedCrop(torch.nn.Modul...
class RandomResizedCrop(torch.nn.Module): '''Crop a random portion of image and resize it to a given size. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions A crop of the original image is made: the crop has a random area (...
6
3
22
3
15
4
3
0.89
1
11
1
1
3
5
4
14
136
20
62
31
49
55
52
23
47
5
1
2
12
18,661
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomRotation
from torch import Tensor from . import functional as F from ..utils import _log_api_usage_once from .functional import _interpolation_modes_from_int, InterpolationMode import torch import numbers from collections.abc import Sequence class RandomRotation(torch.nn.Module): """Rotate the image by angle. If the im...
class RandomRotation(torch.nn.Module): '''Rotate the image by angle. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions. Args: degrees (sequence or number): Range of degrees to select from. If degrees is ...
6
3
15
3
10
3
3
0.74
1
9
1
0
3
5
4
14
90
17
42
17
36
31
39
16
34
5
1
2
12
18,662
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomSolarize
import torch from . import functional as F from ..utils import _log_api_usage_once class RandomSolarize(torch.nn.Module): """Solarize the image randomly with a given probability by inverting all pixel values above a threshold. If img is a Tensor, it is expected to be in [..., 1 or 3, H, W] format, where .....
class RandomSolarize(torch.nn.Module): '''Solarize the image randomly with a given probability by inverting all pixel values above a threshold. If img is a Tensor, it is expected to be in [..., 1 or 3, H, W] format, where ... means it can have an arbitrary number of leading dimensions. If img is PIL Im...
4
2
6
0
4
2
1
1.17
1
2
0
0
3
2
3
13
31
5
12
6
8
14
12
6
8
2
1
1
4
18,663
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomTransforms
from collections.abc import Sequence from ..utils import _log_api_usage_once class RandomTransforms: """Base class for a list of transformations with randomness Args: transforms (sequence): list of transformations """ def __init__(self, transforms): _log_api_usage_once(self) i...
class RandomTransforms: '''Base class for a list of transformations with randomness Args: transforms (sequence): list of transformations ''' def __init__(self, transforms): pass def __call__(self, *args, **kwargs): pass def __repr__(self) -> str: pass
4
1
5
0
5
0
2
0.27
0
4
0
2
3
1
3
3
23
4
15
7
11
4
15
7
11
2
0
1
5
18,664
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.RandomVerticalFlip
import torch from ..utils import _log_api_usage_once from . import functional as F class RandomVerticalFlip(torch.nn.Module): """Vertically flip the given image randomly with a given probability. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of ...
class RandomVerticalFlip(torch.nn.Module): '''Vertically flip the given image randomly with a given probability. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions Args: p (float): probability of the image being ...
4
2
6
0
3
2
1
1.18
1
2
0
1
3
1
3
13
29
5
11
5
7
13
11
5
7
2
1
1
4
18,665
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.Resize
import torch from collections.abc import Sequence from .functional import _interpolation_modes_from_int, InterpolationMode from . import functional as F from ..utils import _log_api_usage_once class Resize(torch.nn.Module): """Resize the input image to the given size. If the image is torch Tensor, it is expect...
class Resize(torch.nn.Module): '''Resize the input image to the given size. If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means a maximum of two leading dimensions Args: size (sequence or int): Desired output size. If size is a sequence like (h, w...
4
2
9
1
6
2
2
2.47
1
8
1
0
3
4
3
13
76
10
19
9
15
47
19
9
15
4
1
1
6
18,666
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.TenCrop
from ..utils import _log_api_usage_once from . import functional as F import torch class TenCrop(torch.nn.Module): """Crop the given image into four corners and the central crop plus the flipped version of these (horizontal flipping is used by default). If the image is torch Tensor, it is expected to h...
class TenCrop(torch.nn.Module): '''Crop the given image into four corners and the central crop plus the flipped version of these (horizontal flipping is used by default). If the image is torch Tensor, it is expected to have [..., H, W] shape, where ... means an arbitrary number of leading dimension...
4
2
5
0
3
2
1
3.1
1
2
0
0
3
2
3
13
48
7
10
6
6
31
10
6
6
1
1
0
3
18,667
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.ToPILImage
from ..utils import _log_api_usage_once from . import functional as F class ToPILImage: """Convert a tensor or an ndarray to PIL Image This transform does not support torchscript. Converts a torch.*Tensor of shape C x H x W or a numpy ndarray of shape H x W x C to a PIL Image while adjusting the valu...
class ToPILImage: '''Convert a tensor or an ndarray to PIL Image This transform does not support torchscript. Converts a torch.*Tensor of shape C x H x W or a numpy ndarray of shape H x W x C to a PIL Image while adjusting the value range depending on the ``mode``. Args: mode (`PIL.Image mo...
4
2
6
1
4
2
1
1.58
0
1
0
0
3
1
3
3
41
10
12
6
8
19
12
6
8
2
0
1
4
18,668
pytorch/vision
pytorch_vision/torchvision/transforms/transforms.py
torchvision.transforms.transforms.ToTensor
from ..utils import _log_api_usage_once from . import functional as F class ToTensor: """Convert a PIL Image or ndarray to tensor and scale the values accordingly. This transform does not support torchscript. Converts a PIL Image or numpy.ndarray (H x W x C) in the range [0, 255] to a torch.FloatTens...
class ToTensor: '''Convert a PIL Image or ndarray to tensor and scale the values accordingly. This transform does not support torchscript. Converts a PIL Image or numpy.ndarray (H x W x C) in the range [0, 255] to a torch.FloatTensor of shape (C x H x W) in the range [0.0, 1.0] if the PIL Image bel...
4
2
4
0
2
2
1
2.57
0
1
0
0
3
0
3
3
34
9
7
4
3
18
7
4
3
1
0
0
3
18,669
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_augment.py
torchvision.transforms.v2._augment.CutMix
import torch from typing import Any, Callable, Optional, Union import math from ._utils import _check_sequence_input, _parse_labels_getter, has_any, is_pure_tensor, query_chw, query_size from torchvision import transforms as _transforms, tv_tensors class CutMix(_BaseMixUpCutMix): """Apply CutMix to the provided ba...
class CutMix(_BaseMixUpCutMix): '''Apply CutMix to the provided batch of images and labels. Paper: `CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features <https://arxiv.org/abs/1905.04899>`_. .. note:: This transform is meant to be used on **batches** of samples,...
3
1
19
5
15
1
3
0.77
1
7
2
0
2
0
2
27
67
15
30
19
27
23
28
19
25
4
3
2
5
18,670
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_augment.py
torchvision.transforms.v2._augment.JPEG
from torchvision.transforms.v2 import functional as F from collections.abc import Sequence import torch from typing import Any, Callable, Optional, Union from ._utils import _check_sequence_input, _parse_labels_getter, has_any, is_pure_tensor, query_chw, query_size from ._transform import _RandomApplyTransform, Transfo...
class JPEG(Transform): '''Apply JPEG compression and decompression to the given images. If the input is a :class:`torch.Tensor`, it is expected to be of dtype uint8, on CPU, and have [..., 3 or 1, H, W] shape, where ... means an arbitrary number of leading dimensions. Args: quality (sequenc...
4
1
5
1
5
0
2
0.73
1
6
0
0
3
1
3
24
34
8
15
6
11
11
14
6
10
3
2
1
5
18,671
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_augment.py
torchvision.transforms.v2._augment.MixUp
from ._utils import _check_sequence_input, _parse_labels_getter, has_any, is_pure_tensor, query_chw, query_size from typing import Any, Callable, Optional, Union from torchvision import transforms as _transforms, tv_tensors class MixUp(_BaseMixUpCutMix): """Apply MixUp to the provided batch of images and labels. ...
class MixUp(_BaseMixUpCutMix): '''Apply MixUp to the provided batch of images and labels. Paper: `mixup: Beyond Empirical Risk Minimization <https://arxiv.org/abs/1710.09412>`_. .. note:: This transform is meant to be used on **batches** of samples, not individual images. See :ref:`...
3
1
9
2
7
1
3
1.47
1
6
2
0
2
0
2
27
46
10
15
5
12
22
13
5
10
4
3
2
5
18,672
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_augment.py
torchvision.transforms.v2._augment.RandomErasing
import numbers from torchvision import transforms as _transforms, tv_tensors from ._utils import _check_sequence_input, _parse_labels_getter, has_any, is_pure_tensor, query_chw, query_size import math from collections.abc import Sequence import torch from torchvision.transforms.v2 import functional as F import warnings...
class RandomErasing(_RandomApplyTransform): '''Randomly select a rectangle region in the input image or video and erase its pixels. This transform does not support PIL Image. 'Random Erasing Data Augmentation' by Zhong et al. See https://arxiv.org/abs/1708.04896 Args: p (float, optional): proba...
6
1
18
2
16
0
4
0.33
1
16
2
0
5
5
5
28
125
19
81
30
68
27
57
23
51
10
3
2
21
18,673
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_augment.py
torchvision.transforms.v2._augment._BaseMixUpCutMix
from ._transform import _RandomApplyTransform, Transform import torch from torch.nn.functional import one_hot from torch.utils._pytree import tree_flatten, tree_unflatten from typing import Any, Callable, Optional, Union import PIL.Image from torchvision import transforms as _transforms, tv_tensors from ._utils import ...
class _BaseMixUpCutMix(Transform): def __init__(self, *, alpha: float=1.0, num_classes: Optional[int]=None, labels_getter='default') -> None: pass def forward(self, *inputs): pass def _check_image_or_video(self, inpt: torch.Tensor, *, batch_size: int): pass def _mixup_label(...
5
0
17
2
15
1
4
0.05
1
12
3
2
4
4
4
25
73
10
61
16
56
3
38
15
33
8
2
1
16
18,674
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_auto_augment.py
torchvision.transforms.v2._auto_augment.AugMix
from torchvision.transforms.v2 import AutoAugmentPolicy, functional as F, InterpolationMode, Transform from typing import Any, Callable, cast, Optional, Union import torch from torchvision.transforms.v2.functional._utils import _FillType, _FillTypeJIT import PIL.Image from torchvision.transforms.v2.functional._meta imp...
class AugMix(_AutoAugmentBase): '''AugMix data augmentation method based on `"AugMix: A Simple Data Processing Method to Improve Robustness and Uncertainty" <https://arxiv.org/abs/1912.02781>`_. This transformation works on images and videos only. If the input is :class:`torch.Tensor`, it should be of ...
4
1
25
3
20
3
5
0.33
1
13
3
0
3
7
3
30
125
18
83
41
70
27
48
31
44
11
3
4
14
18,675
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_auto_augment.py
torchvision.transforms.v2._auto_augment.AutoAugment
from torchvision import transforms as _transforms, tv_tensors from torchvision.transforms.v2.functional._meta import get_size from typing import Any, Callable, cast, Optional, Union import torch from torchvision.transforms.v2.functional._utils import _FillType, _FillTypeJIT from torchvision.transforms.v2 import AutoAug...
class AutoAugment(_AutoAugmentBase): '''AutoAugment data augmentation method based on `"AutoAugment: Learning Augmentation Strategies from Data" <https://arxiv.org/pdf/1805.09501.pdf>`_. This transformation works on images and videos only. If the input is :class:`torch.Tensor`, it should be of type ``t...
4
1
41
2
39
0
3
0.11
1
8
2
0
3
3
3
30
172
13
144
23
133
16
29
15
25
5
3
3
10
18,676
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_auto_augment.py
torchvision.transforms.v2._auto_augment.RandAugment
from torchvision.transforms.v2 import AutoAugmentPolicy, functional as F, InterpolationMode, Transform from typing import Any, Callable, cast, Optional, Union from torchvision import transforms as _transforms, tv_tensors from torchvision.transforms.v2.functional._meta import get_size import torch from torchvision.trans...
class RandAugment(_AutoAugmentBase): '''RandAugment data augmentation method based on `"RandAugment: Practical automated data augmentation with a reduced search space" <https://arxiv.org/abs/1909.13719>`_. This transformation works on images and videos only. If the input is :class:`torch.Tensor`, i...
3
1
15
1
14
1
3
0.33
1
7
1
0
2
4
2
29
80
8
55
22
45
18
21
14
18
4
3
3
5
18,677
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_auto_augment.py
torchvision.transforms.v2._auto_augment.TrivialAugmentWide
from torchvision.transforms.v2.functional._meta import get_size from torchvision.transforms.v2.functional._utils import _FillType, _FillTypeJIT import torch from typing import Any, Callable, cast, Optional, Union from torchvision.transforms.v2 import AutoAugmentPolicy, functional as F, InterpolationMode, Transform from...
class TrivialAugmentWide(_AutoAugmentBase): '''Dataset-independent data-augmentation with TrivialAugment Wide, as described in `"TrivialAugment: Tuning-free Yet State-of-the-Art Data Augmentation" <https://arxiv.org/abs/2103.10158>`_. This transformation works on images and videos only. If the input is...
3
1
13
2
12
1
2
0.34
1
6
1
0
2
2
2
29
67
9
44
17
36
15
18
11
15
3
3
2
4
18,678
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_auto_augment.py
torchvision.transforms.v2._auto_augment._AutoAugmentBase
from torchvision import transforms as _transforms, tv_tensors import torch from torchvision.transforms.v2.functional._geometry import _check_interpolation from typing import Any, Callable, cast, Optional, Union from ._utils import _get_fill, _setup_fill_arg, check_type, is_pure_tensor import PIL.Image from torch.utils....
class _AutoAugmentBase(Transform): def __init__(self, *, interpolation: Union[InterpolationMode, int]=InterpolationMode.NEAREST, fill: Union[_FillType, dict[Union[type, str], _FillType]]=None) -> None: pass def _extract_params_for_v1_transform(self) -> dict[str, Any]: pass def _get_rando...
7
0
25
1
22
2
5
0.07
1
20
5
4
6
3
6
27
155
11
135
41
108
9
54
21
47
17
2
2
29
18,679
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_color.py
torchvision.transforms.v2._color.ColorJitter
from typing import Any, Optional, Union import torch from torchvision.transforms.v2 import functional as F, Transform import collections.abc from torchvision import transforms as _transforms from collections.abc import Sequence class ColorJitter(Transform): """Randomly change the brightness, contrast, saturation a...
class ColorJitter(Transform): '''Randomly change the brightness, contrast, saturation and hue of an image or video. If the input is a :class:`torch.Tensor`, it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions. If img is PIL Image, mode "1", "I", "...
8
1
11
1
10
0
4
0.32
1
10
0
0
5
4
6
27
100
14
65
37
44
21
46
23
39
8
2
2
22
18,680
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_color.py
torchvision.transforms.v2._color.Grayscale
from typing import Any, Optional, Union from torchvision import transforms as _transforms from torchvision.transforms.v2 import functional as F, Transform class Grayscale(Transform): """Convert images or videos to grayscale. If the input is a :class:`torch.Tensor`, it is expected to have [..., 3 or 1, H, ...
class Grayscale(Transform): '''Convert images or videos to grayscale. If the input is a :class:`torch.Tensor`, it is expected to have [..., 3 or 1, H, W] shape, where ... means an arbitrary number of leading dimensions Args: num_output_channels (int): (1 or 3) number of channels desired for out...
3
1
3
0
3
0
1
0.86
1
4
0
0
2
1
2
23
18
5
7
5
4
6
7
5
4
1
2
0
2
18,681
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_color.py
torchvision.transforms.v2._color.RGB
from torchvision.transforms.v2 import functional as F, Transform from typing import Any, Optional, Union class RGB(Transform): """Convert images or videos to RGB (if they are already not RGB). If the input is a :class:`torch.Tensor`, it is expected to have [..., 1 or 3, H, W] shape, where ... means an arb...
class RGB(Transform): '''Convert images or videos to RGB (if they are already not RGB). If the input is a :class:`torch.Tensor`, it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions ''' def __init__(self): pass def transform(self,...
3
1
2
0
2
0
1
0.8
1
3
0
0
2
0
2
23
12
3
5
3
2
4
5
3
2
1
2
0
2
18,682
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_color.py
torchvision.transforms.v2._color.RandomAdjustSharpness
from typing import Any, Optional, Union from ._transform import _RandomApplyTransform from torchvision.transforms.v2 import functional as F, Transform from torchvision import transforms as _transforms class RandomAdjustSharpness(_RandomApplyTransform): """Adjust the sharpness of the image or video with a given pro...
class RandomAdjustSharpness(_RandomApplyTransform): '''Adjust the sharpness of the image or video with a given probability. If the input is a :class:`torch.Tensor`, it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions. Args: sharpness_facto...
3
1
3
0
3
0
1
1.29
1
4
0
0
2
1
2
25
21
5
7
5
4
9
7
5
4
1
3
0
2
18,683
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_color.py
torchvision.transforms.v2._color.RandomAutocontrast
from ._transform import _RandomApplyTransform from torchvision.transforms.v2 import functional as F, Transform from typing import Any, Optional, Union from torchvision import transforms as _transforms class RandomAutocontrast(_RandomApplyTransform): """Autocontrast the pixels of the given image or video with a giv...
class RandomAutocontrast(_RandomApplyTransform): '''Autocontrast the pixels of the given image or video with a given probability. If the input is a :class:`torch.Tensor`, it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions. If img is PIL Image, it...
2
1
2
0
2
0
1
1.75
1
2
0
0
1
0
1
24
15
4
4
3
2
7
4
3
2
1
3
0
1
18,684
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_color.py
torchvision.transforms.v2._color.RandomChannelPermutation
import torch from ._utils import query_chw from torchvision.transforms.v2 import functional as F, Transform from typing import Any, Optional, Union class RandomChannelPermutation(Transform): """Randomly permute the channels of an image or video""" def make_params(self, flat_inputs: list[Any]) -> dict[str, Any...
class RandomChannelPermutation(Transform): '''Randomly permute the channels of an image or video''' def make_params(self, flat_inputs: list[Any]) -> dict[str, Any]: pass def transform(self, inpt: Any, params: dict[str, Any]) -> Any: pass
3
1
3
0
3
0
1
0.17
1
3
0
0
2
0
2
23
9
2
6
4
3
1
6
4
3
1
2
0
2
18,685
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_color.py
torchvision.transforms.v2._color.RandomEqualize
from ._transform import _RandomApplyTransform from torchvision.transforms.v2 import functional as F, Transform from torchvision import transforms as _transforms from typing import Any, Optional, Union class RandomEqualize(_RandomApplyTransform): """Equalize the histogram of the given image or video with a given pr...
class RandomEqualize(_RandomApplyTransform): '''Equalize the histogram of the given image or video with a given probability. If the input is a :class:`torch.Tensor`, it is expected to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions. If img is PIL Image, it is e...
2
1
2
0
2
0
1
1.75
1
2
0
0
1
0
1
24
15
4
4
3
2
7
4
3
2
1
3
0
1
18,686
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_color.py
torchvision.transforms.v2._color.RandomGrayscale
from torchvision.transforms.v2 import functional as F, Transform from typing import Any, Optional, Union from torchvision import transforms as _transforms from ._transform import _RandomApplyTransform from ._utils import query_chw class RandomGrayscale(_RandomApplyTransform): """Randomly convert image or videos to...
class RandomGrayscale(_RandomApplyTransform): '''Randomly convert image or videos to grayscale with a probability of p (default 0.1). If the input is a :class:`torch.Tensor`, it is expected to have [..., 3 or 1, H, W] shape, where ... means an arbitrary number of leading dimensions The output has the s...
4
1
2
0
2
0
1
0.78
1
5
0
0
3
0
3
26
23
7
9
6
5
7
9
6
5
1
3
0
3
18,687
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_color.py
torchvision.transforms.v2._color.RandomInvert
from torchvision import transforms as _transforms from torchvision.transforms.v2 import functional as F, Transform from ._transform import _RandomApplyTransform from typing import Any, Optional, Union class RandomInvert(_RandomApplyTransform): """Inverts the colors of the given image or video with a given probabil...
class RandomInvert(_RandomApplyTransform): '''Inverts the colors of the given image or video with a given probability. If img is a Tensor, it is expected to be in [..., 1 or 3, H, W] format, where ... means it can have an arbitrary number of leading dimensions. If img is PIL Image, it is expected to be...
2
1
2
0
2
0
1
1.75
1
2
0
0
1
0
1
24
15
4
4
3
2
7
4
3
2
1
3
0
1
18,688
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_color.py
torchvision.transforms.v2._color.RandomPhotometricDistort
from ._utils import query_chw import torch from typing import Any, Optional, Union from torchvision.transforms.v2 import functional as F, Transform class RandomPhotometricDistort(Transform): """Randomly distorts the image or video as used in `SSD: Single Shot MultiBox Detector <https://arxiv.org/abs/1512.02325...
class RandomPhotometricDistort(Transform): '''Randomly distorts the image or video as used in `SSD: Single Shot MultiBox Detector <https://arxiv.org/abs/1512.02325>`_. This transform relies on :class:`~torchvision.transforms.v2.ColorJitter` under the hood to adjust the contrast, saturation, hue, bright...
4
1
14
0
14
0
4
0.47
1
7
1
0
3
5
3
24
68
5
43
19
32
20
28
11
24
7
2
1
11
18,689
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_color.py
torchvision.transforms.v2._color.RandomPosterize
from torchvision import transforms as _transforms from torchvision.transforms.v2 import functional as F, Transform from typing import Any, Optional, Union from ._transform import _RandomApplyTransform class RandomPosterize(_RandomApplyTransform): """Posterize the image or video with a given probability by reducing...
class RandomPosterize(_RandomApplyTransform): '''Posterize the image or video with a given probability by reducing the number of bits for each color channel. If the input is a :class:`torch.Tensor`, it should be of type torch.uint8, and it is expected to have [..., 1 or 3, H, W] shape, where ... means ...
3
1
3
0
3
0
1
1.29
1
5
0
0
2
1
2
25
21
5
7
5
4
9
7
5
4
1
3
0
2
18,690
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_color.py
torchvision.transforms.v2._color.RandomSolarize
from typing import Any, Optional, Union from torchvision.transforms.v2 import functional as F, Transform from torchvision import transforms as _transforms from ._transform import _RandomApplyTransform class RandomSolarize(_RandomApplyTransform): """Solarize the image or video with a given probability by inverting ...
class RandomSolarize(_RandomApplyTransform): '''Solarize the image or video with a given probability by inverting all pixel values above a threshold. If img is a Tensor, it is expected to be in [..., 1 or 3, H, W] format, where ... means it can have an arbitrary number of leading dimensions. If img...
4
1
3
0
3
0
1
0.82
1
4
0
0
3
1
3
26
26
6
11
7
7
9
11
7
7
1
3
0
3
18,691
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_container.py
torchvision.transforms.v2._container.Compose
from torchvision.transforms.v2 import Transform from torchvision import transforms as _transforms from collections.abc import Sequence from typing import Any, Callable, Optional, Union class Compose(Transform): """Composes several transforms together. This transform does not support torchscript. Please, s...
class Compose(Transform): '''Composes several transforms together. This transform does not support torchscript. Please, see the note below. Args: transforms (list of ``Transform`` objects): list of transforms to compose. Example: >>> transforms.Compose([ >>> transforms.C...
4
1
6
0
6
0
3
1.11
1
5
0
0
3
1
3
24
50
10
19
10
15
21
18
10
14
3
2
1
8
18,692
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_container.py
torchvision.transforms.v2._container.RandomApply
import torch from torchvision import transforms as _transforms from collections.abc import Sequence from torch import nn from typing import Any, Callable, Optional, Union from torchvision.transforms.v2 import Transform class RandomApply(Transform): """Apply randomly a list of transformations with a given probabili...
class RandomApply(Transform): '''Apply randomly a list of transformations with a given probability. .. note:: In order to script the transformation, please use ``torch.nn.ModuleList`` as input instead of list/tuple of transforms as shown below: >>> transforms = transforms.RandomApply(to...
5
1
7
1
6
0
3
0.56
1
6
0
0
4
2
4
25
52
13
25
13
20
14
25
13
20
5
2
1
11
18,693
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_container.py
torchvision.transforms.v2._container.RandomChoice
from collections.abc import Sequence from torchvision import transforms as _transforms from torchvision.transforms.v2 import Transform from typing import Any, Callable, Optional, Union import torch class RandomChoice(Transform): """Apply single transformation randomly picked from a list. This transform does n...
class RandomChoice(Transform): '''Apply single transformation randomly picked from a list. This transform does not support torchscript. Args: transforms (sequence or torch.nn.Module): list of transformations p (list of floats or None, optional): probability of each transform being picked. ...
3
1
11
2
10
0
3
0.4
1
6
0
0
2
2
2
23
35
7
20
12
13
8
15
8
12
4
2
1
5
18,694
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_container.py
torchvision.transforms.v2._container.RandomOrder
from collections.abc import Sequence import torch from typing import Any, Callable, Optional, Union from torchvision.transforms.v2 import Transform from torchvision import transforms as _transforms class RandomOrder(Transform): """Apply a list of transformations in a random order. This transform does not supp...
class RandomOrder(Transform): '''Apply a list of transformations in a random order. This transform does not support torchscript. Args: transforms (sequence or torch.nn.Module): list of transformations ''' def __init__(self, transforms: Sequence[Callable]) -> None: pass def for...
3
1
6
0
6
0
3
0.38
1
3
0
0
2
1
2
23
22
4
13
8
10
5
13
8
10
3
2
1
5
18,695
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_deprecated.py
torchvision.transforms.v2._deprecated.ToTensor
import PIL.Image from typing import Any, Union import torch import warnings import numpy as np from torchvision.transforms import functional as _F from torchvision.transforms.v2 import Transform class ToTensor(Transform): """[DEPRECATED] Use ``v2.Compose([v2.ToImage(), v2.ToDtype(torch.float32, scale=True)])`` ins...
class ToTensor(Transform): '''[DEPRECATED] Use ``v2.Compose([v2.ToImage(), v2.ToDtype(torch.float32, scale=True)])`` instead. Convert a PIL Image or ndarray to tensor and scale the values accordingly. .. warning:: :class:`v2.ToTensor` is deprecated and will be removed in a future release. P...
3
1
5
0
5
0
1
1.55
1
4
0
0
2
0
2
23
39
11
11
4
8
17
7
4
4
1
2
0
2
18,696
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_geometry.py
torchvision.transforms.v2._geometry.CenterCrop
from typing import Any, Callable, Literal, Optional, Union from torchvision import transforms as _transforms, tv_tensors from ._utils import _check_padding_arg, _check_padding_mode_arg, _check_sequence_input, _get_fill, _setup_angle, _setup_fill_arg, _setup_number_or_seq, _setup_size, get_bounding_boxes, has_all, has_a...
class CenterCrop(Transform): '''Crop the input at the center. If the input is a :class:`torch.Tensor` or a ``TVTensor`` (e.g. :class:`~torchvision.tv_tensors.Image`, :class:`~torchvision.tv_tensors.Video`, :class:`~torchvision.tv_tensors.BoundingBoxes` etc.) it can have arbitrary number of leading batc...
3
1
3
0
3
0
1
1.57
1
4
0
0
2
1
2
23
24
6
7
5
4
11
7
5
4
1
2
0
2
18,697
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_geometry.py
torchvision.transforms.v2._geometry.ElasticTransform
from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform from torchvision.transforms.v2.functional._utils import _FillType from ._utils import _check_padding_arg, _check_padding_mode_arg, _check_sequence_input, _get_fill, _setup_angle, _setup_fill_arg, _setup_number_or_seq, _setup_size, get_b...
class ElasticTransform(Transform): '''Transform the input with elastic transformations. If the input is a :class:`torch.Tensor` or a ``TVTensor`` (e.g. :class:`~torchvision.tv_tensors.Image`, :class:`~torchvision.tv_tensors.Video`, :class:`~torchvision.tv_tensors.BoundingBoxes` etc.) it can have arbitr...
4
1
15
1
13
1
2
0.83
1
9
1
0
3
5
3
24
88
12
42
23
32
35
30
17
26
5
2
2
7
18,698
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_geometry.py
torchvision.transforms.v2._geometry.FiveCrop
from torchvision import transforms as _transforms, tv_tensors from typing import Any, Callable, Literal, Optional, Union import warnings from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform from collections.abc import Sequence from ._utils import _check_padding_arg, _check_padding_mode_ar...
class FiveCrop(Transform): '''Crop the image or video into four corners and the central crop. If the input is a :class:`torch.Tensor` or a :class:`~torchvision.tv_tensors.Image` or a :class:`~torchvision.tv_tensors.Video` it can have arbitrary number of leading batch dimensions. For example, the image ...
5
1
4
0
4
0
2
1.82
1
8
2
0
4
1
4
25
57
9
17
7
12
31
14
7
9
2
2
1
6
18,699
pytorch/vision
pytorch_vision/torchvision/transforms/v2/_geometry.py
torchvision.transforms.v2._geometry.Pad
from torchvision.transforms.v2.functional._utils import _FillType from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform from torchvision import transforms as _transforms, tv_tensors from ._utils import _check_padding_arg, _check_padding_mode_arg, _check_sequence_input, _get_fill, _setup_an...
class Pad(Transform): '''Pad the input on all sides with the given "pad" value. If the input is a :class:`torch.Tensor` or a ``TVTensor`` (e.g. :class:`~torchvision.tv_tensors.Image`, :class:`~torchvision.tv_tensors.Video`, :class:`~torchvision.tv_tensors.BoundingBoxes` etc.) it can have arbitrary numb...
4
1
9
1
8
1
2
1.24
1
8
0
0
3
4
3
24
70
15
25
16
16
31
20
11
16
2
2
1
5