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,700 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.RandomAffine | from typing import Any, Callable, Literal, Optional, Union
from torchvision import transforms as _transforms, tv_tensors
import torch
import numbers
from collections.abc import Sequence
from ._utils import _check_padding_arg, _check_padding_mode_arg, _check_sequence_input, _get_fill, _setup_angle, _setup_fill_arg, _set... |
class RandomAffine(Transform):
'''Random affine transformation the input keeping center invariant.
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 ... | 4 | 1 | 25 | 3 | 22 | 0 | 5 | 0.5 | 1 | 10 | 1 | 0 | 3 | 8 | 3 | 24 | 118 | 16 | 68 | 35 | 55 | 34 | 49 | 26 | 45 | 9 | 2 | 3 | 15 |
18,701 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.RandomCrop | from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform
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_any, is_pure_tensor, query_size
from t... |
class RandomCrop(Transform):
'''Crop the input at a random location.
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 leadi... | 5 | 1 | 26 | 5 | 21 | 1 | 5 | 0.44 | 1 | 9 | 0 | 0 | 4 | 6 | 4 | 25 | 153 | 30 | 86 | 31 | 74 | 38 | 57 | 24 | 52 | 9 | 2 | 2 | 19 |
18,702 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.RandomHorizontalFlip | from torchvision import transforms as _transforms, tv_tensors
from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform
from ._transform import _RandomApplyTransform
from typing import Any, Callable, Literal, Optional, Union
class RandomHorizontalFlip(_RandomApplyTransform):
"""Horizontal... |
class RandomHorizontalFlip(_RandomApplyTransform):
'''Horizontally flip the input with a given probability.
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.)
... | 2 | 1 | 2 | 0 | 2 | 0 | 1 | 2 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 24 | 16 | 4 | 4 | 3 | 2 | 8 | 4 | 3 | 2 | 1 | 3 | 0 | 1 |
18,703 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.RandomIoUCrop | from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform
from torchvision import transforms as _transforms, tv_tensors
from torchvision.ops.boxes import box_iou
from ._utils import _check_padding_arg, _check_padding_mode_arg, _check_sequence_input, _get_fill, _setup_angle, _setup_fill_arg, _s... |
class RandomIoUCrop(Transform):
'''Random IoU crop transformation from
`"SSD: Single Shot MultiBox Detector" <https://arxiv.org/abs/1512.02325>`_.
This transformation requires an image or video data and ``tv_tensors.BoundingBoxes`` in the input.
.. warning::
In order to properly remove the boun... | 5 | 1 | 24 | 3 | 19 | 2 | 4 | 0.39 | 1 | 13 | 3 | 0 | 4 | 6 | 4 | 25 | 124 | 18 | 77 | 38 | 64 | 30 | 54 | 30 | 49 | 8 | 2 | 3 | 15 |
18,704 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.RandomPerspective | from torchvision.transforms.functional import _get_perspective_coeffs
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_any, is_pure_tensor, query_size
from torchvision.tra... |
class RandomPerspective(_RandomApplyTransform):
'''Perform a random perspective transformation of the input with a given probability.
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_tenso... | 4 | 1 | 19 | 1 | 17 | 0 | 1 | 0.35 | 1 | 9 | 1 | 0 | 3 | 4 | 3 | 26 | 83 | 10 | 54 | 29 | 44 | 19 | 28 | 23 | 24 | 2 | 3 | 1 | 4 |
18,705 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.RandomResize | from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform
from typing import Any, Callable, Literal, Optional, Union
import torch
class RandomResize(Transform):
"""Randomly resize the input.
This transformation can be used together with ``RandomCrop`` as data augmentations to train
... |
class RandomResize(Transform):
'''Randomly resize the input.
This transformation can be used together with ``RandomCrop`` as data augmentations to train
models on image segmentation task.
Output spatial size is randomly sampled from the interval ``[min_size, max_size]``:
.. code-block:: python
... | 4 | 1 | 6 | 0 | 6 | 0 | 1 | 1.85 | 1 | 7 | 1 | 0 | 3 | 4 | 3 | 24 | 68 | 11 | 20 | 15 | 10 | 37 | 12 | 9 | 8 | 1 | 2 | 0 | 3 |
18,706 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.RandomResizedCrop | from torchvision import transforms as _transforms, tv_tensors
import torch
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_any, is_pure_tensor, query_size
from collection... |
class RandomResizedCrop(Transform):
'''Crop a random portion of the input and resize it to a given size.
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.)
i... | 4 | 1 | 22 | 2 | 19 | 1 | 3 | 0.75 | 1 | 10 | 1 | 0 | 3 | 6 | 3 | 24 | 117 | 17 | 59 | 29 | 48 | 44 | 43 | 22 | 39 | 5 | 2 | 2 | 10 |
18,707 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.RandomRotation | from collections.abc import Sequence
import torch
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_any, is_pure_tensor, query_size
from torchvision import transforms as _t... |
class RandomRotation(Transform):
'''Rotate the input by angle.
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 bat... | 4 | 1 | 11 | 1 | 10 | 0 | 1 | 0.94 | 1 | 10 | 1 | 0 | 3 | 6 | 3 | 24 | 77 | 13 | 33 | 20 | 22 | 31 | 18 | 13 | 14 | 2 | 2 | 1 | 4 |
18,708 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.RandomShortestSize | from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform
from typing import Any, Callable, Literal, Optional, Union
import torch
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,... |
class RandomShortestSize(Transform):
'''Randomly resize the input.
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... | 4 | 1 | 9 | 1 | 8 | 0 | 2 | 1.15 | 1 | 8 | 1 | 0 | 3 | 4 | 3 | 24 | 66 | 10 | 26 | 19 | 16 | 30 | 18 | 13 | 14 | 2 | 2 | 1 | 5 |
18,709 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.RandomVerticalFlip | from typing import Any, Callable, Literal, Optional, Union
from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform
from torchvision import transforms as _transforms, tv_tensors
from ._transform import _RandomApplyTransform
class RandomVerticalFlip(_RandomApplyTransform):
"""Vertically f... |
class RandomVerticalFlip(_RandomApplyTransform):
'''Vertically flip the input with a given probability.
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... | 2 | 1 | 2 | 0 | 2 | 0 | 1 | 2 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 24 | 16 | 4 | 4 | 3 | 2 | 8 | 4 | 3 | 2 | 1 | 3 | 0 | 1 |
18,710 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.RandomZoomOut | from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform
from typing import Any, Callable, Literal, Optional, Union
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... |
class RandomZoomOut(_RandomApplyTransform):
''' "Zoom out" transformation from
`"SSD: Single Shot MultiBox Detector" <https://arxiv.org/abs/1512.02325>`_.
This transformation randomly pads images, videos, bounding boxes and masks creating a zoom out effect.
Output spatial size is randomly sampled from ... | 4 | 1 | 11 | 2 | 9 | 0 | 1 | 0.79 | 1 | 8 | 0 | 0 | 3 | 3 | 3 | 26 | 66 | 14 | 29 | 22 | 20 | 23 | 24 | 17 | 20 | 2 | 3 | 1 | 4 |
18,711 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.Resize | from typing import Any, Callable, Literal, Optional, Union
from torchvision import transforms as _transforms, tv_tensors
from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform
from collections.abc import Sequence
class Resize(Transform):
"""Resize the input to the given size.
If t... |
class Resize(Transform):
'''Resize the input to the given size.
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 ba... | 3 | 1 | 17 | 1 | 16 | 0 | 3 | 1.5 | 1 | 8 | 1 | 0 | 2 | 4 | 2 | 23 | 99 | 14 | 34 | 14 | 25 | 51 | 16 | 8 | 13 | 5 | 2 | 2 | 6 |
18,712 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.ScaleJitter | 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_any, is_pure_tensor, query_size
from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform
import... |
class ScaleJitter(Transform):
'''Perform Large Scale Jitter on the input according to
`"Simple Copy-Paste is a Strong Data Augmentation Method for Instance Segmentation" <https://arxiv.org/abs/2012.07177>`_.
If the input is a :class:`torch.Tensor` or a ``TVTensor`` (e.g. :class:`~torchvision.tv_tensors.Ima... | 4 | 1 | 8 | 1 | 8 | 0 | 1 | 1.33 | 1 | 8 | 1 | 0 | 3 | 4 | 3 | 24 | 65 | 9 | 24 | 19 | 14 | 32 | 16 | 13 | 12 | 1 | 2 | 0 | 3 |
18,713 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_geometry.py | torchvision.transforms.v2._geometry.TenCrop | from torchvision.transforms.v2 import functional as F, InterpolationMode, Transform
from typing import Any, Callable, Literal, Optional, Union
from torchvision import transforms as _transforms, tv_tensors
from collections.abc import Sequence
from ._utils import _check_padding_arg, _check_padding_mode_arg, _check_sequen... |
class TenCrop(Transform):
'''Crop the image or video into four corners and the central crop plus the flipped version of
these (horizontal flipping is used by default).
If the input is a :class:`torch.Tensor` or a :class:`~torchvision.tv_tensors.Image` or a
:class:`~torchvision.tv_tensors.Video` it can ... | 5 | 1 | 4 | 0 | 4 | 0 | 2 | 0.89 | 1 | 9 | 2 | 0 | 4 | 2 | 4 | 25 | 43 | 9 | 18 | 8 | 13 | 16 | 15 | 8 | 10 | 2 | 2 | 1 | 6 |
18,714 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_meta.py | torchvision.transforms.v2._meta.ClampBoundingBoxes | from torchvision import tv_tensors
from typing import Any, Union
from torchvision.tv_tensors._bounding_boxes import CLAMPING_MODE_TYPE
from torchvision.transforms.v2 import functional as F, Transform
class ClampBoundingBoxes(Transform):
"""Clamp bounding boxes to their corresponding image dimensions.
Args:
... |
class ClampBoundingBoxes(Transform):
'''Clamp bounding boxes to their corresponding image dimensions.
Args:
clamping_mode: Default is "auto" which relies on the input box'
``clamping_mode`` attribute. Read more in :ref:`clamping_mode_tuto`
for more details on how to use this tra... | 3 | 1 | 2 | 0 | 2 | 1 | 1 | 1 | 1 | 3 | 1 | 0 | 1 | 0 | 1 | 22 | 11 | 4 | 4 | 3 | 2 | 4 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
18,715 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_meta.py | torchvision.transforms.v2._meta.ConvertBoundingBoxFormat | from torchvision import tv_tensors
from typing import Any, Union
from torchvision.transforms.v2 import functional as F, Transform
class ConvertBoundingBoxFormat(Transform):
"""Convert bounding box coordinates to the given ``format``, eg from "CXCYWH" to "XYXY".
Args:
format (str or tv_tensors.Bounding... |
class ConvertBoundingBoxFormat(Transform):
'''Convert bounding box coordinates to the given ``format``, eg from "CXCYWH" to "XYXY".
Args:
format (str or tv_tensors.BoundingBoxFormat): output bounding box format.
Possible values are defined by :class:`~torchvision.tv_tensors.BoundingBoxForma... | 3 | 1 | 3 | 0 | 3 | 1 | 1 | 1 | 1 | 5 | 2 | 0 | 2 | 1 | 2 | 23 | 17 | 4 | 7 | 5 | 4 | 7 | 7 | 5 | 4 | 1 | 2 | 0 | 2 |
18,716 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_misc.py | torchvision.transforms.v2._misc.ConvertImageDtype | import torch
from torchvision import transforms as _transforms, tv_tensors
from typing import Any, Callable, Optional, Union
from torchvision.transforms.v2 import functional as F, Transform
class ConvertImageDtype(Transform):
"""[DEPRECATED] Use ``v2.ToDtype(dtype, scale=True)`` instead.
Convert input image t... |
class ConvertImageDtype(Transform):
'''[DEPRECATED] Use ``v2.ToDtype(dtype, scale=True)`` instead.
Convert input image to the given ``dtype`` and scale the values accordingly.
.. warning::
Consider using ``ToDtype(dtype, scale=True)`` instead. See :class:`~torchvision.transforms.v2.ToDtype`.
Th... | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 2.29 | 1 | 3 | 0 | 0 | 2 | 1 | 2 | 23 | 33 | 10 | 7 | 5 | 4 | 16 | 7 | 5 | 4 | 1 | 2 | 0 | 2 |
18,717 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_misc.py | torchvision.transforms.v2._misc.GaussianBlur | from torchvision.transforms.v2 import functional as F, Transform
from typing import Any, Callable, Optional, Union
from torchvision import transforms as _transforms, tv_tensors
import torch
from collections.abc import Sequence
from ._utils import _parse_labels_getter, _setup_number_or_seq, _setup_size, get_bounding_box... |
class GaussianBlur(Transform):
'''Blurs image with randomly chosen Gaussian blur kernel.
The convolution will be using reflection padding corresponding to the kernel size, to maintain the input shape.
If the input is a Tensor, it is expected
to have [..., C, H, W] shape, where ... means an arbitrary nu... | 4 | 1 | 6 | 1 | 5 | 0 | 2 | 0.61 | 1 | 7 | 0 | 0 | 3 | 2 | 3 | 24 | 38 | 9 | 18 | 11 | 12 | 11 | 16 | 9 | 12 | 4 | 2 | 2 | 6 |
18,718 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_misc.py | torchvision.transforms.v2._misc.GaussianNoise | from typing import Any, Callable, Optional, Union
from torchvision.transforms.v2 import functional as F, Transform
class GaussianNoise(Transform):
"""Add gaussian noise to images or videos.
The input tensor is expected to be in [..., 1 or 3, H, W] format,
where ... means it can have an arbitrary number of... |
class GaussianNoise(Transform):
'''Add gaussian noise to images or videos.
The input tensor is expected to be in [..., 1 or 3, H, W] format,
where ... means it can have an arbitrary number of leading dimensions.
Each image or frame in a batch will be transformed independently i.e. the
noise added t... | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 1.5 | 1 | 4 | 0 | 0 | 2 | 3 | 2 | 23 | 25 | 5 | 8 | 6 | 5 | 12 | 8 | 6 | 5 | 1 | 2 | 0 | 2 |
18,719 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_misc.py | torchvision.transforms.v2._misc.Identity | from torchvision.transforms.v2 import functional as F, Transform
from typing import Any, Callable, Optional, Union
class Identity(Transform):
def transform(self, inpt: Any, params: dict[str, Any]) -> Any:
return inpt |
class Identity(Transform):
def transform(self, inpt: Any, params: dict[str, Any]) -> Any:
pass | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 22 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 2 | 0 | 1 |
18,720 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_misc.py | torchvision.transforms.v2._misc.Lambda | from torchvision.transforms.v2 import functional as F, Transform
from typing import Any, Callable, Optional, Union
class Lambda(Transform):
"""Apply a user-defined function as a transform.
This transform does not support torchscript.
Args:
lambd (function): Lambda/function to be used for transfor... |
class Lambda(Transform):
'''Apply a user-defined function as a transform.
This transform does not support torchscript.
Args:
lambd (function): Lambda/function to be used for transform.
'''
def __init__(self, lambd: Callable[[Any], Any], *types: type):
pass
def transform(self, ... | 4 | 1 | 5 | 0 | 5 | 0 | 2 | 0.28 | 1 | 4 | 0 | 0 | 3 | 2 | 3 | 24 | 29 | 6 | 18 | 10 | 14 | 5 | 17 | 9 | 13 | 2 | 2 | 1 | 5 |
18,721 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_misc.py | torchvision.transforms.v2._misc.LinearTransformation | from ._utils import _parse_labels_getter, _setup_number_or_seq, _setup_size, get_bounding_boxes, has_any, is_pure_tensor
from typing import Any, Callable, Optional, Union
from torchvision.transforms.v2 import functional as F, Transform
from torchvision import transforms as _transforms, tv_tensors
import torch
import PI... |
class LinearTransformation(Transform):
'''Transform a tensor image or video 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 whi... | 4 | 1 | 18 | 3 | 15 | 0 | 4 | 0.29 | 1 | 10 | 2 | 0 | 3 | 2 | 3 | 24 | 79 | 16 | 49 | 13 | 45 | 14 | 32 | 13 | 28 | 5 | 2 | 1 | 11 |
18,722 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_misc.py | torchvision.transforms.v2._misc.Normalize | from collections.abc import Sequence
from torchvision import transforms as _transforms, tv_tensors
from typing import Any, Callable, Optional, Union
import PIL.Image
from ._utils import _parse_labels_getter, _setup_number_or_seq, _setup_size, get_bounding_boxes, has_any, is_pure_tensor
from torchvision.transforms.v2 im... |
class Normalize(Transform):
'''Normalize a tensor image or video 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.*Te... | 4 | 1 | 3 | 0 | 3 | 0 | 1 | 1.08 | 1 | 8 | 0 | 0 | 3 | 3 | 3 | 24 | 33 | 8 | 12 | 8 | 8 | 13 | 12 | 8 | 8 | 2 | 2 | 1 | 4 |
18,723 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_misc.py | torchvision.transforms.v2._misc.SanitizeBoundingBoxes | from torchvision.transforms.v2 import functional as F, Transform
import torch
from torchvision import transforms as _transforms, tv_tensors
from torch.utils._pytree import tree_flatten, tree_unflatten
from ._utils import _parse_labels_getter, _setup_number_or_seq, _setup_size, get_bounding_boxes, has_any, is_pure_tenso... |
class SanitizeBoundingBoxes(Transform):
'''Remove degenerate/invalid bounding boxes and their corresponding labels and masks.
This transform removes bounding boxes and their associated labels/masks that:
- are below a given ``min_size`` or ``min_area``: by default this also removes degenerate boxes that ha... | 4 | 1 | 23 | 4 | 19 | 0 | 5 | 0.5 | 1 | 12 | 2 | 0 | 3 | 4 | 3 | 24 | 110 | 23 | 58 | 25 | 49 | 29 | 41 | 20 | 37 | 10 | 2 | 4 | 16 |
18,724 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_misc.py | torchvision.transforms.v2._misc.ToDtype | from typing import Any, Callable, Optional, Union
import warnings
from torchvision.transforms.v2 import functional as F, Transform
import torch
from torchvision import transforms as _transforms, tv_tensors
from ._utils import _parse_labels_getter, _setup_number_or_seq, _setup_size, get_bounding_boxes, has_any, is_pure_... |
class ToDtype(Transform):
'''Converts the input to a specific dtype, optionally scaling the values for images or videos.
.. note::
``ToDtype(dtype, scale=True)`` is the recommended replacement for ``ConvertImageDtype(dtype)``.
Args:
dtype (``torch.dtype`` or dict of ``TVTensor`` -> ``torch.... | 3 | 1 | 25 | 3 | 22 | 1 | 5 | 0.33 | 1 | 10 | 2 | 0 | 2 | 2 | 2 | 23 | 70 | 10 | 45 | 10 | 40 | 15 | 24 | 8 | 21 | 7 | 2 | 2 | 10 |
18,725 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_temporal.py | torchvision.transforms.v2._temporal.UniformTemporalSubsample | from typing import Any
from torchvision.transforms.v2 import functional as F, Transform
import torch
class UniformTemporalSubsample(Transform):
"""Uniformly subsample ``num_samples`` indices from the temporal dimension of the video.
Videos are expected to be of shape ``[..., T, C, H, W]`` where ``T`` denotes ... |
class UniformTemporalSubsample(Transform):
'''Uniformly subsample ``num_samples`` indices from the temporal dimension of the video.
Videos are expected to be of shape ``[..., T, C, H, W]`` where ``T`` denotes the temporal dimension.
When ``num_samples`` is larger than the size of temporal dimension of the ... | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 1 | 1 | 4 | 0 | 0 | 2 | 1 | 2 | 23 | 20 | 6 | 7 | 5 | 4 | 7 | 7 | 5 | 4 | 1 | 2 | 0 | 2 |
18,726 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_transform.py | torchvision.transforms.v2._transform.Transform | from torch.utils._pytree import tree_flatten, tree_unflatten
from .functional._utils import _get_kernel
from torch import nn
from torchvision import tv_tensors
import enum
from torchvision.utils import _log_api_usage_once
import torch
import PIL.Image
from typing import Any, Callable
from torchvision.transforms.v2._uti... |
class Transform(nn.Module):
'''Base class to implement your own v2 transforms.
See :ref:`sphx_glr_auto_examples_transforms_plot_custom_transforms.py` for
more details.
'''
def __init__(self) -> None:
pass
def check_inputs(self, flat_inputs: list[Any]) -> None:
pass
def m... | 12 | 4 | 10 | 1 | 6 | 3 | 2 | 0.72 | 1 | 16 | 2 | 54 | 11 | 0 | 11 | 21 | 144 | 26 | 69 | 27 | 57 | 50 | 53 | 26 | 41 | 5 | 1 | 3 | 22 |
18,727 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_transform.py | torchvision.transforms.v2._transform._RandomApplyTransform | from torch.utils._pytree import tree_flatten, tree_unflatten
from typing import Any, Callable
import torch
class _RandomApplyTransform(Transform):
def __init__(self, p: float=0.5) -> None:
if not 0.0 <= p <= 1.0:
raise ValueError('`p` should be a floating point value in the interval [0.0, 1.0]... |
class _RandomApplyTransform(Transform):
def __init__(self, p: float=0.5) -> None:
pass
def forward(self, *inputs: Any) -> Any:
pass | 3 | 0 | 15 | 4 | 10 | 2 | 3 | 0.14 | 1 | 5 | 0 | 12 | 2 | 1 | 2 | 23 | 32 | 8 | 21 | 9 | 18 | 3 | 16 | 8 | 13 | 4 | 2 | 1 | 6 |
18,728 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_type_conversion.py | torchvision.transforms.v2._type_conversion.PILToTensor | from typing import Any, Optional, Union
import PIL.Image
from torchvision.transforms.v2 import functional as F, Transform
import torch
class PILToTensor(Transform):
"""Convert a PIL Image to a tensor of the same type - this does not scale values.
This transform does not support torchscript.
Converts a PI... |
class PILToTensor(Transform):
'''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 transform(self, inpt: PIL.Image.Image, params: dict[str, Any]) -> ... | 2 | 1 | 2 | 0 | 2 | 0 | 1 | 1 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 22 | 12 | 4 | 4 | 3 | 2 | 4 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
18,729 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_type_conversion.py | torchvision.transforms.v2._type_conversion.ToImage | import torch
from torchvision.transforms.v2 import functional as F, Transform
import numpy as np
from torchvision.transforms.v2._utils import is_pure_tensor
from torchvision import tv_tensors
import PIL.Image
from typing import Any, Optional, Union
class ToImage(Transform):
"""Convert a tensor, ndarray, or PIL Ima... |
class ToImage(Transform):
'''Convert a tensor, ndarray, or PIL Image to :class:`~torchvision.tv_tensors.Image`
; this does not scale values.
This transform does not support torchscript.
'''
def transform(self, inpt: Union[torch.Tensor, PIL.Image.Image, np.ndarray], params: dict[str, Any]) -> tv_te... | 2 | 1 | 4 | 0 | 4 | 0 | 1 | 0.67 | 1 | 4 | 1 | 0 | 1 | 0 | 1 | 22 | 13 | 3 | 6 | 5 | 2 | 4 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
18,730 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_type_conversion.py | torchvision.transforms.v2._type_conversion.ToPILImage | import numpy as np
from torchvision.transforms.v2._utils import is_pure_tensor
from typing import Any, Optional, Union
from torchvision.transforms.v2 import functional as F, Transform
import torch
import PIL.Image
from torchvision import tv_tensors
class ToPILImage(Transform):
"""Convert a tensor or an ndarray to ... |
class ToPILImage(Transform):
'''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 (`P... | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 1.56 | 1 | 4 | 0 | 0 | 2 | 1 | 2 | 23 | 31 | 8 | 9 | 7 | 4 | 14 | 7 | 5 | 4 | 1 | 2 | 0 | 2 |
18,731 | pytorch/vision | pytorch_vision/torchvision/transforms/v2/_type_conversion.py | torchvision.transforms.v2._type_conversion.ToPureTensor | from typing import Any, Optional, Union
from torchvision.transforms.v2 import functional as F, Transform
import torch
from torchvision import tv_tensors
class ToPureTensor(Transform):
"""Convert all TVTensors to pure tensors, removing associated metadata (if any).
This doesn't scale or change the values, only... |
class ToPureTensor(Transform):
'''Convert all TVTensors to pure tensors, removing associated metadata (if any).
This doesn't scale or change the values, only the type.
'''
def transform(self, inpt: Any, params: dict[str, Any]) -> torch.Tensor:
pass | 2 | 1 | 2 | 0 | 2 | 0 | 1 | 0.75 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 22 | 10 | 3 | 4 | 3 | 2 | 3 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
18,732 | pytorch/vision | pytorch_vision/torchvision/tv_tensors/_bounding_boxes.py | torchvision.tv_tensors._bounding_boxes.BoundingBoxFormat | from enum import Enum
class BoundingBoxFormat(Enum):
"""Coordinate format of a bounding box.
Available formats are:
* ``XYXY``: bounding box represented via corners; x1, y1 being top left;
x2, y2 being bottom right.
* ``XYWH``: bounding box represented via corner, width and height; x1, y1
... |
class BoundingBoxFormat(Enum):
'''Coordinate format of a bounding box.
Available formats are:
* ``XYXY``: bounding box represented via corners; x1, y1 being top left;
x2, y2 being bottom right.
* ``XYWH``: bounding box represented via corner, width and height; x1, y1
being top left; w, h be... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 13 | 3 | 4 | 4 | 3 | 6 | 4 | 4 | 3 | 0 | 4 | 0 | 0 |
18,733 | pytorch/vision | pytorch_vision/torchvision/tv_tensors/_bounding_boxes.py | torchvision.tv_tensors._bounding_boxes.BoundingBoxes | from ._tv_tensor import TVTensor
from collections.abc import Mapping, Sequence
import torch
from torch.utils._pytree import tree_flatten
from typing import Any, Optional
class BoundingBoxes(TVTensor):
""":class:`torch.Tensor` subclass for bounding boxes with shape ``[N, K]``.
.. note::
Support for rot... |
class BoundingBoxes(TVTensor):
''':class:`torch.Tensor` subclass for bounding boxes with shape ``[N, K]``.
.. note::
Support for rotated bounding boxes was released in TorchVision 0.23 and
is currently a BETA feature. We don't expect the API to change, but
there may be some rare edge-ca... | 7 | 1 | 12 | 0 | 11 | 2 | 3 | 0.53 | 1 | 9 | 1 | 1 | 2 | 1 | 4 | 72 | 77 | 8 | 47 | 27 | 26 | 25 | 27 | 10 | 22 | 5 | 3 | 2 | 11 |
18,734 | pytorch/vision | pytorch_vision/torchvision/tv_tensors/_dataset_wrapper.py | torchvision.tv_tensors._dataset_wrapper.VisionDatasetTVTensorWrapper | from copy import copy
from torchvision import datasets, tv_tensors
import contextlib
class VisionDatasetTVTensorWrapper:
def __init__(self, dataset, target_keys):
dataset_cls = type(dataset)
if not isinstance(dataset, datasets.VisionDataset):
raise TypeError(f"This wrapper is meant for... |
class VisionDatasetTVTensorWrapper:
def __init__(self, dataset, target_keys):
pass
def __getattr__(self, item):
pass
def __getitem__(self, idx):
pass
def __len__(self):
pass
def __reduce__(self):
pass | 6 | 0 | 16 | 2 | 11 | 3 | 2 | 0.3 | 0 | 11 | 5 | 0 | 5 | 6 | 5 | 5 | 86 | 14 | 56 | 18 | 50 | 17 | 39 | 18 | 33 | 7 | 0 | 3 | 12 |
18,735 | pytorch/vision | pytorch_vision/torchvision/tv_tensors/_dataset_wrapper.py | torchvision.tv_tensors._dataset_wrapper.WrapperFactories | class WrapperFactories(dict):
def register(self, dataset_cls):
def decorator(wrapper_factory):
self[dataset_cls] = wrapper_factory
return wrapper_factory
return decorator | class WrapperFactories(dict):
def register(self, dataset_cls):
pass
def decorator(wrapper_factory):
pass | 3 | 0 | 5 | 1 | 4 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 28 | 7 | 1 | 6 | 3 | 3 | 0 | 6 | 3 | 3 | 1 | 2 | 0 | 2 |
18,736 | pytorch/vision | pytorch_vision/torchvision/tv_tensors/_image.py | torchvision.tv_tensors._image.Image | import torch
from ._tv_tensor import TVTensor
import PIL.Image
from typing import Any
class Image(TVTensor):
""":class:`torch.Tensor` subclass for images with shape ``[..., C, H, W]``.
.. note::
In the :ref:`transforms <transforms>`, ``Image`` instances are largely
interchangeable with pure :... |
class Image(TVTensor):
''':class:`torch.Tensor` subclass for images with shape ``[..., C, H, W]``.
.. note::
In the :ref:`transforms <transforms>`, ``Image`` instances are largely
interchangeable with pure :class:`torch.Tensor`. See
:ref:`this note <passthrough_heuristic>` for more deta... | 3 | 1 | 11 | 2 | 10 | 1 | 3 | 0.8 | 1 | 5 | 0 | 1 | 2 | 0 | 2 | 70 | 43 | 8 | 20 | 12 | 9 | 16 | 12 | 5 | 8 | 4 | 3 | 1 | 5 |
18,737 | pytorch/vision | pytorch_vision/torchvision/tv_tensors/_mask.py | torchvision.tv_tensors._mask.Mask | import torch
import PIL.Image
from typing import Any
from ._tv_tensor import TVTensor
class Mask(TVTensor):
""":class:`torch.Tensor` subclass for segmentation and detection masks with shape ``[..., H, W]``.
Args:
data (tensor-like, PIL.Image.Image): Any data that can be turned into a tensor with :func... |
class Mask(TVTensor):
''':class:`torch.Tensor` subclass for segmentation and detection masks with shape ``[..., H, W]``.
Args:
data (tensor-like, PIL.Image.Image): Any data that can be turned into a tensor with :func:`torch.as_tensor` as
well as PIL images.
dtype (torch.dtype, optio... | 2 | 1 | 15 | 2 | 13 | 0 | 2 | 0.79 | 1 | 4 | 0 | 1 | 1 | 0 | 1 | 69 | 29 | 4 | 14 | 11 | 4 | 11 | 7 | 4 | 4 | 2 | 3 | 1 | 2 |
18,738 | pytorch/vision | pytorch_vision/torchvision/tv_tensors/_torch_function_helpers.py | torchvision.tv_tensors._torch_function_helpers._ReturnTypeCM | class _ReturnTypeCM:
def __init__(self, to_restore):
self.to_restore = to_restore
def __enter__(self):
return self
def __exit__(self, *args):
global _TORCHFUNCTION_SUBCLASS
_TORCHFUNCTION_SUBCLASS = self.to_restore | class _ReturnTypeCM:
def __init__(self, to_restore):
pass
def __enter__(self):
pass
def __exit__(self, *args):
pass | 4 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 10 | 2 | 8 | 6 | 3 | 0 | 8 | 6 | 3 | 1 | 0 | 0 | 3 |
18,739 | pytorch/vision | pytorch_vision/torchvision/tv_tensors/_tv_tensor.py | torchvision.tv_tensors._tv_tensor.TVTensor | from torch._C import DisableTorchFunctionSubclass
from torch.types import _device, _dtype, _size
from torchvision.tv_tensors._torch_function_helpers import _FORCE_TORCHFUNCTION_SUBCLASS, _must_return_subclass
from collections.abc import Mapping, Sequence
from typing import Any, Callable, TypeVar
import torch
class TVT... |
class TVTensor(torch.Tensor):
'''Base class for all TVTensors.
You probably don't want to use this class unless you're defining your own
custom TVTensors. See
:ref:`sphx_glr_auto_examples_transforms_plot_custom_tv_tensors.py` for details.
'''
@staticmethod
def _to_tensor(data: Any, dtype: t... | 17 | 2 | 10 | 1 | 6 | 4 | 2 | 0.69 | 1 | 9 | 0 | 10 | 6 | 0 | 9 | 68 | 118 | 18 | 62 | 36 | 29 | 43 | 39 | 13 | 29 | 4 | 2 | 1 | 16 |
18,740 | pytorch/vision | pytorch_vision/torchvision/tv_tensors/_video.py | torchvision.tv_tensors._video.Video | from ._tv_tensor import TVTensor
import torch
from typing import Any
class Video(TVTensor):
""":class:`torch.Tensor` subclass for videos with shape ``[..., T, C, H, W]``.
Args:
data (tensor-like): Any data that can be turned into a tensor with :func:`torch.as_tensor`.
dtype (torch.dtype, optio... |
class Video(TVTensor):
''':class:`torch.Tensor` subclass for videos with shape ``[..., T, C, H, W]``.
Args:
data (tensor-like): Any data that can be turned into a tensor with :func:`torch.as_tensor`.
dtype (torch.dtype, optional): Desired data type. If omitted, will be inferred from
... | 3 | 1 | 7 | 0 | 7 | 1 | 2 | 0.73 | 1 | 5 | 0 | 1 | 2 | 0 | 2 | 70 | 28 | 3 | 15 | 11 | 5 | 11 | 8 | 4 | 5 | 2 | 3 | 1 | 3 |
18,741 | pytorch/vision | pytorch_vision/references/optical_flow/transforms.py | transforms.AsymmetricColorJitter | import torchvision.transforms as T
import torch
class AsymmetricColorJitter(T.ColorJitter):
def __init__(self, brightness=0, contrast=0, saturation=0, hue=0, p=0.2):
super().__init__(brightness=brightness, contrast=contrast, saturation=saturation, hue=hue)
self.p = p
def forward(self, img1, i... |
class AsymmetricColorJitter(T.ColorJitter):
def __init__(self, brightness=0, contrast=0, saturation=0, hue=0, p=0.2):
pass
def forward(self, img1, img2, flow, valid_flow_mask):
pass | 3 | 0 | 8 | 1 | 6 | 1 | 2 | 0.23 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 17 | 19 | 3 | 13 | 5 | 10 | 3 | 12 | 5 | 9 | 2 | 2 | 1 | 3 |
18,742 | pytorch/vision | pytorch_vision/references/segmentation/transforms.py | transforms.CenterCrop | from torchvision.transforms import functional as F
class CenterCrop:
def __init__(self, size):
self.size = size
def __call__(self, image, target):
image = F.center_crop(image, self.size)
target = F.center_crop(target, self.size)
return (image, target) |
class CenterCrop:
def __init__(self, size):
pass
def __call__(self, image, target):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 8 | 1 | 7 | 4 | 4 | 0 | 7 | 4 | 4 | 1 | 0 | 0 | 2 |
18,743 | pytorch/vision | pytorch_vision/references/detection/transforms.py | transforms.Compose | from torchvision.transforms import functional as F, InterpolationMode, transforms as T
class Compose:
def __init__(self, transforms):
self.transforms = transforms
def __call__(self, image, target):
for t in self.transforms:
image, target = t(image, target)
return (image, t... |
class Compose:
def __init__(self, transforms):
pass
def __call__(self, image, target):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 2 | 0 | 1 | 3 |
18,744 | pytorch/vision | pytorch_vision/references/optical_flow/transforms.py | transforms.Compose | import torch
class Compose(torch.nn.Module):
def __init__(self, transforms):
super().__init__()
self.transforms = transforms
def forward(self, img1, img2, flow, valid_flow_mask):
for t in self.transforms:
img1, img2, flow, valid_flow_mask = t(img1, img2, flow, valid_flow_m... |
class Compose(torch.nn.Module):
def __init__(self, transforms):
pass
def forward(self, img1, img2, flow, valid_flow_mask):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 9 | 1 | 8 | 5 | 5 | 0 | 8 | 5 | 5 | 2 | 1 | 1 | 3 |
18,745 | pytorch/vision | pytorch_vision/references/segmentation/transforms.py | transforms.Compose | from torchvision import transforms as T
class Compose:
def __init__(self, transforms):
self.transforms = transforms
def __call__(self, image, target):
for t in self.transforms:
image, target = t(image, target)
return (image, target) |
class Compose:
def __init__(self, transforms):
pass
def __call__(self, image, target):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 2 | 0 | 1 | 3 |
18,746 | pytorch/vision | pytorch_vision/references/video_classification/transforms.py | transforms.ConvertBCHWtoCBHW | import torch
import torch.nn as nn
class ConvertBCHWtoCBHW(nn.Module):
"""Convert tensor from (B, C, H, W) to (C, B, H, W)"""
def forward(self, vid: torch.Tensor) -> torch.Tensor:
return vid.permute(1, 0, 2, 3) |
class ConvertBCHWtoCBHW(nn.Module):
'''Convert tensor from (B, C, H, W) to (C, B, H, W)'''
def forward(self, vid: torch.Tensor) -> torch.Tensor:
pass | 2 | 1 | 2 | 0 | 2 | 0 | 1 | 0.33 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 11 | 5 | 1 | 3 | 2 | 1 | 1 | 3 | 2 | 1 | 1 | 1 | 0 | 1 |
18,747 | pytorch/vision | pytorch_vision/references/optical_flow/transforms.py | transforms.ConvertImageDtype | import torchvision.transforms.functional as F
import torch
class ConvertImageDtype(torch.nn.Module):
def __init__(self, dtype):
super().__init__()
self.dtype = dtype
def forward(self, img1, img2, flow, valid_flow_mask):
img1 = F.convert_image_dtype(img1, dtype=self.dtype)
img2... |
class ConvertImageDtype(torch.nn.Module):
def __init__(self, dtype):
pass
def forward(self, img1, img2, flow, valid_flow_mask):
pass | 3 | 0 | 6 | 1 | 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 13 | 3 | 10 | 4 | 7 | 0 | 10 | 4 | 7 | 1 | 1 | 0 | 2 |
18,748 | pytorch/vision | pytorch_vision/references/detection/transforms.py | transforms.FixedSizeCrop | from torch import nn, Tensor
from torchvision.transforms import functional as F, InterpolationMode, transforms as T
import torch
class FixedSizeCrop(nn.Module):
def __init__(self, size, fill=0, padding_mode='constant'):
super().__init__()
size = tuple(T._setup_size(size, error_msg='Please provide ... |
class FixedSizeCrop(nn.Module):
def __init__(self, size, fill=0, padding_mode='constant'):
pass
def _pad(self, img, target, padding):
pass
def _crop(self, img, target, top, left, height, width):
pass
def forward(self, img, target=None):
pass | 5 | 0 | 17 | 3 | 15 | 1 | 3 | 0.03 | 1 | 3 | 0 | 0 | 4 | 4 | 4 | 14 | 73 | 13 | 59 | 22 | 54 | 2 | 56 | 22 | 51 | 6 | 1 | 2 | 13 |
18,749 | pytorch/vision | pytorch_vision/references/optical_flow/transforms.py | transforms.MakeValidFlowMask | import torch
class MakeValidFlowMask(torch.nn.Module):
def __init__(self, threshold=1000):
super().__init__()
self.threshold = threshold
def forward(self, img1, img2, flow, valid_flow_mask):
if flow is not None and valid_flow_mask is None:
valid_flow_mask = (flow.abs() < s... |
class MakeValidFlowMask(torch.nn.Module):
def __init__(self, threshold=1000):
pass
def forward(self, img1, img2, flow, valid_flow_mask):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 2 | 0.38 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 12 | 1 | 8 | 4 | 5 | 3 | 8 | 4 | 5 | 2 | 1 | 1 | 3 |
18,750 | pytorch/vision | pytorch_vision/references/optical_flow/transforms.py | transforms.Normalize | import torch
import torchvision.transforms.functional as F
class Normalize(torch.nn.Module):
def __init__(self, mean, std):
super().__init__()
self.mean = mean
self.std = std
def forward(self, img1, img2, flow, valid_flow_mask):
img1 = F.normalize(img1, mean=self.mean, std=sel... |
class Normalize(torch.nn.Module):
def __init__(self, mean, std):
pass
def forward(self, img1, img2, flow, valid_flow_mask):
pass | 3 | 0 | 5 | 1 | 4 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 11 | 2 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
18,751 | pytorch/vision | pytorch_vision/references/segmentation/transforms.py | transforms.Normalize | from torchvision.transforms import functional as F
class Normalize:
def __init__(self, mean, std):
self.mean = mean
self.std = std
def __call__(self, image, target):
image = F.normalize(image, mean=self.mean, std=self.std)
return (image, target) |
class Normalize:
def __init__(self, mean, std):
pass
def __call__(self, image, target):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 2 | 2 | 2 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 0 | 0 | 2 |
18,752 | pytorch/vision | pytorch_vision/references/detection/transforms.py | transforms.PILToTensor | from typing import Dict, List, Optional, Tuple, Union
from torchvision.transforms import functional as F, InterpolationMode, transforms as T
from torch import nn, Tensor
class PILToTensor(nn.Module):
def forward(self, image: Tensor, target: Optional[Dict[str, Tensor]]=None) -> Tuple[Tensor, Optional[Dict[str, Ten... |
class PILToTensor(nn.Module):
def forward(self, image: Tensor, target: Optional[Dict[str, Tensor]]=None) -> Tuple[Tensor, Optional[Dict[str, Tensor]]]:
pass | 2 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 11 | 6 | 0 | 6 | 4 | 2 | 0 | 4 | 2 | 2 | 1 | 1 | 0 | 1 |
18,753 | pytorch/vision | pytorch_vision/references/optical_flow/transforms.py | transforms.PILToTensor | import torchvision.transforms.functional as F
import torch
class PILToTensor(torch.nn.Module):
def forward(self, img1, img2, flow, valid_flow_mask):
img1 = F.pil_to_tensor(img1)
img2 = F.pil_to_tensor(img2)
if flow is not None:
flow = torch.from_numpy(flow)
if valid_flo... |
class PILToTensor(torch.nn.Module):
def forward(self, img1, img2, flow, valid_flow_mask):
pass | 2 | 0 | 9 | 1 | 8 | 0 | 3 | 0.33 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 11 | 13 | 1 | 9 | 2 | 7 | 3 | 9 | 2 | 7 | 3 | 1 | 1 | 3 |
18,754 | pytorch/vision | pytorch_vision/references/segmentation/transforms.py | transforms.PILToTensor | from torchvision.transforms import functional as F
import torch
import numpy as np
class PILToTensor:
def __call__(self, image, target):
image = F.pil_to_tensor(image)
target = torch.as_tensor(np.array(target), dtype=torch.int64)
return (image, target) |
class PILToTensor:
def __call__(self, image, target):
pass | 2 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 5 | 0 | 5 | 2 | 3 | 0 | 5 | 2 | 3 | 1 | 0 | 0 | 1 |
18,755 | pytorch/vision | pytorch_vision/references/segmentation/transforms.py | transforms.RandomCrop | from torchvision import transforms as T
from torchvision.transforms import functional as F
class RandomCrop:
def __init__(self, size):
self.size = size
def __call__(self, image, target):
image = pad_if_smaller(image, self.size)
target = pad_if_smaller(target, self.size, fill=255)
... |
class RandomCrop:
def __init__(self, size):
pass
def __call__(self, image, target):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 11 | 1 | 10 | 5 | 7 | 0 | 10 | 5 | 7 | 1 | 0 | 0 | 2 |
18,756 | pytorch/vision | pytorch_vision/references/classification/transforms.py | transforms.RandomCutMix | from typing import Tuple
from torch import Tensor
from torchvision.transforms import functional as F
import torch
import math
class RandomCutMix(torch.nn.Module):
"""Randomly apply CutMix to the provided batch and targets.
The class implements the data augmentations as described in the paper
`"CutMix: Regu... |
class RandomCutMix(torch.nn.Module):
'''Randomly apply CutMix to the provided batch and targets.
The class implements the data augmentations as described in the paper
`"CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features"
<https://arxiv.org/abs/1905.04899>`_.
Args:... | 4 | 2 | 25 | 4 | 18 | 3 | 4 | 0.36 | 1 | 8 | 0 | 0 | 3 | 4 | 3 | 13 | 92 | 17 | 55 | 22 | 51 | 20 | 48 | 22 | 44 | 8 | 1 | 1 | 12 |
18,757 | pytorch/vision | pytorch_vision/references/optical_flow/transforms.py | transforms.RandomErasing | import torch
import torchvision.transforms.functional as F
import torchvision.transforms as T
class RandomErasing(T.RandomErasing):
def __init__(self, p=0.5, scale=(0.02, 0.33), ratio=(0.3, 3.3), value=0, inplace=False, max_erase=1):
super().__init__(p=p, scale=scale, ratio=ratio, value=value, inplace=inp... |
class RandomErasing(T.RandomErasing):
def __init__(self, p=0.5, scale=(0.02, 0.33), ratio=(0.3, 3.3), value=0, inplace=False, max_erase=1):
pass
def forward(self, img1, img2, flow, valid_flow_mask):
pass | 3 | 0 | 7 | 1 | 6 | 0 | 3 | 0.46 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 16 | 22 | 3 | 13 | 6 | 10 | 6 | 13 | 6 | 10 | 3 | 2 | 1 | 5 |
18,758 | pytorch/vision | pytorch_vision/references/detection/transforms.py | transforms.RandomHorizontalFlip | from typing import Dict, List, Optional, Tuple, Union
from torchvision.transforms import functional as F, InterpolationMode, transforms as T
from torch import nn, Tensor
import torch
class RandomHorizontalFlip(T.RandomHorizontalFlip):
def forward(self, image: Tensor, target: Optional[Dict[str, Tensor]]=None) -> T... |
class RandomHorizontalFlip(T.RandomHorizontalFlip):
def forward(self, image: Tensor, target: Optional[Dict[str, Tensor]]=None) -> Tuple[Tensor, Optional[Dict[str, Tensor]]]:
pass | 2 | 0 | 15 | 0 | 15 | 0 | 5 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 16 | 0 | 16 | 6 | 12 | 0 | 14 | 4 | 12 | 5 | 1 | 3 | 5 |
18,759 | pytorch/vision | pytorch_vision/references/optical_flow/transforms.py | transforms.RandomHorizontalFlip | import torch
import torchvision.transforms.functional as F
import torchvision.transforms as T
class RandomHorizontalFlip(T.RandomHorizontalFlip):
def forward(self, img1, img2, flow, valid_flow_mask):
if torch.rand(1) > self.p:
return (img1, img2, flow, valid_flow_mask)
img1 = F.hflip(i... |
class RandomHorizontalFlip(T.RandomHorizontalFlip):
def forward(self, img1, img2, flow, valid_flow_mask):
pass | 2 | 0 | 10 | 1 | 9 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 14 | 11 | 1 | 10 | 2 | 8 | 0 | 10 | 2 | 8 | 3 | 2 | 1 | 3 |
18,760 | pytorch/vision | pytorch_vision/references/segmentation/transforms.py | transforms.RandomHorizontalFlip | from torchvision.transforms import functional as F
import random
class RandomHorizontalFlip:
def __init__(self, flip_prob):
self.flip_prob = flip_prob
def __call__(self, image, target):
if random.random() < self.flip_prob:
image = F.hflip(image)
target = F.hflip(target... |
class RandomHorizontalFlip:
def __init__(self, flip_prob):
pass
def __call__(self, image, target):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 9 | 1 | 8 | 4 | 5 | 0 | 8 | 4 | 5 | 2 | 0 | 1 | 3 |
18,761 | pytorch/vision | pytorch_vision/references/detection/transforms.py | transforms.RandomIoUCrop | import torch
import torchvision
from torch import nn, Tensor
from torchvision.transforms import functional as F, InterpolationMode, transforms as T
from typing import Dict, List, Optional, Tuple, Union
class RandomIoUCrop(nn.Module):
def __init__(self, min_scale: float=0.3, max_scale: float=1.0, min_aspect_ratio:... |
class RandomIoUCrop(nn.Module):
def __init__(self, min_scale: float=0.3, max_scale: float=1.0, min_aspect_ratio: float=0.5, max_aspect_ratio: float=2.0, sampler_options: Optional[List[float]]=None, trials: int=40):
pass
def forward(self, image: Tensor, target: Optional[Dict[str, Tensor]]=None) -> Tup... | 3 | 0 | 42 | 5 | 34 | 4 | 7 | 0.12 | 1 | 7 | 0 | 0 | 2 | 6 | 2 | 12 | 85 | 10 | 68 | 35 | 55 | 8 | 55 | 25 | 52 | 12 | 1 | 3 | 14 |
18,762 | pytorch/vision | pytorch_vision/references/classification/transforms.py | transforms.RandomMixUp | from typing import Tuple
from torch import Tensor
import torch
class RandomMixUp(torch.nn.Module):
"""Randomly apply MixUp to the provided batch and targets.
The class implements the data augmentations as described in the paper
`"mixup: Beyond Empirical Risk Minimization" <https://arxiv.org/abs/1710.09412>... |
class RandomMixUp(torch.nn.Module):
'''Randomly apply MixUp to the provided batch and targets.
The class implements the data augmentations as described in the paper
`"mixup: Beyond Empirical Risk Minimization" <https://arxiv.org/abs/1710.09412>`_.
Args:
num_classes (int): number of classes used... | 4 | 2 | 22 | 4 | 15 | 3 | 4 | 0.4 | 1 | 8 | 0 | 0 | 3 | 4 | 3 | 13 | 81 | 15 | 47 | 12 | 43 | 19 | 38 | 12 | 34 | 8 | 1 | 1 | 12 |
18,763 | pytorch/vision | pytorch_vision/references/detection/transforms.py | transforms.RandomPhotometricDistort | import torch
from typing import Dict, List, Optional, Tuple, Union
from torch import nn, Tensor
from torchvision.transforms import functional as F, InterpolationMode, transforms as T
class RandomPhotometricDistort(nn.Module):
def __init__(self, contrast: Tuple[float, float]=(0.5, 1.5), saturation: Tuple[float, fl... |
class RandomPhotometricDistort(nn.Module):
def __init__(self, contrast: Tuple[float, float]=(0.5, 1.5), saturation:
pass
def forward(self, image: Tensor, target: Optional[Dict[str, Tensor]]=None) -> Tuple[Tensor, Optional[Dict[str, Tensor]]]:
pass | 3 | 0 | 28 | 5 | 24 | 0 | 8 | 0 | 1 | 5 | 0 | 0 | 2 | 5 | 2 | 12 | 58 | 10 | 48 | 22 | 36 | 0 | 38 | 13 | 35 | 14 | 1 | 2 | 15 |
18,764 | pytorch/vision | pytorch_vision/references/segmentation/transforms.py | transforms.RandomResize | from torchvision import transforms as T
from torchvision.transforms import functional as F
import random
class RandomResize:
def __init__(self, min_size, max_size=None):
self.min_size = min_size
if max_size is None:
max_size = min_size
self.max_size = max_size
def __call__... |
class RandomResize:
def __init__(self, min_size, max_size=None):
pass
def __call__(self, image, target):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 2 | 2 | 2 | 2 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 2 | 0 | 1 | 3 |
18,765 | pytorch/vision | pytorch_vision/references/optical_flow/transforms.py | transforms.RandomResizeAndCrop | import torch
import torchvision.transforms.functional as F
class RandomResizeAndCrop(torch.nn.Module):
def __init__(self, crop_size, min_scale=-0.2, max_scale=0.5, stretch_prob=0.8):
super().__init__()
self.crop_size = crop_size
self.min_scale = min_scale
self.max_scale = max_scale... |
class RandomResizeAndCrop(torch.nn.Module):
def __init__(self, crop_size, min_scale=-0.2, max_scale=0.5, stretch_prob=0.8):
pass
def forward(self, img1, img2, flow, valid_flow_mask):
pass
def _resize_sparse_flow(self, flow, valid_flow_mask, scale_x=1.0, scale_y=1.0):
pass | 4 | 0 | 30 | 6 | 20 | 5 | 2 | 0.42 | 1 | 3 | 0 | 0 | 3 | 6 | 3 | 13 | 104 | 19 | 60 | 29 | 56 | 25 | 57 | 29 | 53 | 5 | 1 | 2 | 7 |
18,766 | pytorch/vision | pytorch_vision/references/detection/transforms.py | transforms.RandomShortestSize | from typing import Dict, List, Optional, Tuple, Union
from torchvision.transforms import functional as F, InterpolationMode, transforms as T
from torch import nn, Tensor
import torch
class RandomShortestSize(nn.Module):
def __init__(self, min_size: Union[List[int], Tuple[int], int], max_size: int, interpolation: ... |
class RandomShortestSize(nn.Module):
def __init__(self, min_size: Union[List[int], Tuple[int], int], max_size: int, interpolation: InterpolationMode=InterpolationMode.BILINEAR):
pass
def forward(self, image: Tensor, target: Optional[Dict[str, Tensor]]=None) -> Tuple[Tensor, Optional[Dict[str, Tensor]... | 3 | 0 | 16 | 3 | 14 | 0 | 3 | 0 | 1 | 6 | 1 | 0 | 2 | 3 | 2 | 12 | 34 | 6 | 28 | 18 | 18 | 0 | 19 | 11 | 16 | 3 | 1 | 2 | 5 |
18,767 | pytorch/vision | pytorch_vision/references/optical_flow/transforms.py | transforms.RandomVerticalFlip | import torch
import torchvision.transforms.functional as F
import torchvision.transforms as T
class RandomVerticalFlip(T.RandomVerticalFlip):
def forward(self, img1, img2, flow, valid_flow_mask):
if torch.rand(1) > self.p:
return (img1, img2, flow, valid_flow_mask)
img1 = F.vflip(img1)... |
class RandomVerticalFlip(T.RandomVerticalFlip):
def forward(self, img1, img2, flow, valid_flow_mask):
pass | 2 | 0 | 10 | 1 | 9 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 14 | 11 | 1 | 10 | 2 | 8 | 0 | 10 | 2 | 8 | 3 | 2 | 1 | 3 |
18,768 | pytorch/vision | pytorch_vision/references/detection/transforms.py | transforms.RandomZoomOut | import torch
from torchvision.transforms import functional as F, InterpolationMode, transforms as T
from typing import Dict, List, Optional, Tuple, Union
from torch import nn, Tensor
class RandomZoomOut(nn.Module):
def __init__(self, fill: Optional[List[float]]=None, side_range: Tuple[float, float]=(1.0, 4.0), p:... |
class RandomZoomOut(nn.Module):
def __init__(self, fill: Optional[List[float]]=None, side_range: Tuple[float, float]=(1.0, 4.0), p:
pass
@torch.jit.unused
def _get_fill_value(self, is_pil):
pass
def forward(self, image: Tensor, target: Optional[Dict[str, Tensor]]=None) -> Tuple[Tensor... | 5 | 0 | 19 | 3 | 15 | 1 | 4 | 0.06 | 1 | 7 | 0 | 0 | 3 | 3 | 3 | 13 | 61 | 10 | 48 | 22 | 39 | 3 | 39 | 17 | 35 | 8 | 1 | 2 | 13 |
18,769 | pytorch/vision | pytorch_vision/references/detection/transforms.py | transforms.ScaleJitter | from typing import Dict, List, Optional, Tuple, Union
from torch import nn, Tensor
from torchvision.transforms import functional as F, InterpolationMode, transforms as T
import torch
class ScaleJitter(nn.Module):
"""Randomly resizes the image and its bounding boxes within the specified scale range.
The class ... |
class ScaleJitter(nn.Module):
'''Randomly resizes the image and its bounding boxes within the specified scale range.
The class implements the Scale Jitter augmentation as described in the paper
`"Simple Copy-Paste is a Strong Data Augmentation Method for Instance Segmentation" <https://arxiv.org/abs/2012.... | 3 | 1 | 21 | 3 | 19 | 0 | 4 | 0.26 | 1 | 7 | 1 | 0 | 2 | 4 | 2 | 12 | 56 | 8 | 38 | 20 | 27 | 10 | 24 | 12 | 21 | 6 | 1 | 2 | 7 |
18,770 | pytorch/vision | pytorch_vision/references/detection/transforms.py | transforms.SimpleCopyPaste | from torchvision.transforms import functional as F, InterpolationMode, transforms as T
from typing import Dict, List, Optional, Tuple, Union
import torch
from torch import nn, Tensor
class SimpleCopyPaste(torch.nn.Module):
def __init__(self, blending=True, resize_interpolation=F.InterpolationMode.BILINEAR):
... |
class SimpleCopyPaste(torch.nn.Module):
def __init__(self, blending=True, resize_interpolation=F.InterpolationMode.BILINEAR):
pass
def forward(self, images: List[torch.Tensor], targets: List[Dict[str, Tensor]]) -> Tuple[List[torch.Tensor], List[Dict[str, Tensor]]]:
pass
def __repr__(self... | 4 | 0 | 16 | 1 | 13 | 2 | 2 | 0.15 | 1 | 7 | 1 | 0 | 3 | 2 | 3 | 13 | 51 | 6 | 39 | 17 | 33 | 6 | 24 | 15 | 20 | 4 | 1 | 2 | 6 |
18,771 | pytorch/vision | pytorch_vision/references/detection/transforms.py | transforms.ToDtype | from torch import nn, Tensor
import torch
from torchvision.transforms import functional as F, InterpolationMode, transforms as T
from typing import Dict, List, Optional, Tuple, Union
class ToDtype(nn.Module):
def __init__(self, dtype: torch.dtype, scale: bool=False) -> None:
super().__init__()
sel... |
class ToDtype(nn.Module):
def __init__(self, dtype: torch.dtype, scale: bool=False) -> None:
pass
def forward(self, image: Tensor, target: Optional[Dict[str, Tensor]]=None) -> Tuple[Tensor, Optional[Dict[str, Tensor]]]:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 4 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 12 | 7 | 7 | 0 | 10 | 5 | 7 | 2 | 1 | 1 | 3 |
18,772 | pytorch/vision | pytorch_vision/references/segmentation/transforms.py | transforms.ToDtype | from torchvision.transforms import functional as F
class ToDtype:
def __init__(self, dtype, scale=False):
self.dtype = dtype
self.scale = scale
def __call__(self, image, target):
if not self.scale:
return (image.to(dtype=self.dtype), target)
image = F.convert_image... |
class ToDtype:
def __init__(self, dtype, scale=False):
pass
def __call__(self, image, target):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 2 | 2 | 2 | 2 | 10 | 1 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 2 | 0 | 1 | 3 |
18,773 | pytorch/vision | pytorch_vision/references/optical_flow/transforms.py | transforms.ValidateModelInput | import torch
class ValidateModelInput(torch.nn.Module):
def forward(self, img1, img2, flow, valid_flow_mask):
if not all((isinstance(arg, torch.Tensor) for arg in (img1, img2, flow, valid_flow_mask) if arg is not None)):
raise TypeError('This method expects all input arguments to be of type to... |
class ValidateModelInput(torch.nn.Module):
def forward(self, img1, img2, flow, valid_flow_mask):
pass | 2 | 0 | 19 | 3 | 16 | 0 | 8 | 0.06 | 1 | 4 | 0 | 0 | 1 | 0 | 1 | 11 | 21 | 3 | 17 | 3 | 15 | 1 | 17 | 3 | 15 | 8 | 1 | 2 | 8 |
18,774 | pytorch/vision | pytorch_vision/references/segmentation/utils.py | utils.ConfusionMatrix | import torch.distributed as dist
import torch
class ConfusionMatrix:
def __init__(self, num_classes):
self.num_classes = num_classes
self.mat = None
def update(self, a, b):
n = self.num_classes
if self.mat is None:
self.mat = torch.zeros((n, n), dtype=torch.int64, ... |
class ConfusionMatrix:
def __init__(self, num_classes):
pass
def update(self, a, b):
pass
def reset(self):
pass
def compute(self):
pass
def reduce_from_all_processes(self):
pass
def __str__(self):
pass | 7 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 6 | 2 | 6 | 6 | 35 | 5 | 30 | 17 | 23 | 0 | 25 | 17 | 18 | 2 | 0 | 1 | 7 |
18,775 | pytorch/vision | pytorch_vision/references/classification/utils.py | utils.ExponentialMovingAverage | import torch
import torch.distributed as dist
class ExponentialMovingAverage(torch.optim.swa_utils.AveragedModel):
"""Maintains moving averages of model parameters using an exponential decay.
``ema_avg = decay * avg_model_param + (1 - decay) * model_param``
`torch.optim.swa_utils.AveragedModel <https://pyt... |
class ExponentialMovingAverage(torch.optim.swa_utils.AveragedModel):
'''Maintains moving averages of model parameters using an exponential decay.
``ema_avg = decay * avg_model_param + (1 - decay) * model_param``
`torch.optim.swa_utils.AveragedModel <https://pytorch.org/docs/stable/optim.html#custom-averagi... | 3 | 1 | 4 | 1 | 3 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 4 | 12 | 2 | 5 | 3 | 2 | 5 | 5 | 3 | 2 | 1 | 2 | 0 | 2 |
18,776 | pytorch/vision | pytorch_vision/references/optical_flow/utils.py | utils.InputPadder | import torch.nn.functional as F
class InputPadder:
"""Pads images such that dimensions are divisible by 8"""
def __init__(self, dims, mode='sintel'):
self.ht, self.wd = dims[-2:]
pad_ht = ((self.ht // 8 + 1) * 8 - self.ht) % 8
pad_wd = ((self.wd // 8 + 1) * 8 - self.wd) % 8
if ... |
class InputPadder:
'''Pads images such that dimensions are divisible by 8'''
def __init__(self, dims, mode='sintel'):
pass
def pad(self, *inputs):
pass
def unpad(self, x):
pass | 4 | 1 | 5 | 0 | 5 | 0 | 1 | 0.4 | 0 | 0 | 0 | 0 | 3 | 3 | 3 | 3 | 25 | 4 | 15 | 10 | 11 | 6 | 14 | 10 | 10 | 2 | 0 | 1 | 4 |
18,777 | pytorch/vision | pytorch_vision/references/classification/utils.py | utils.MetricLogger | import datetime
import time
import torch.distributed as dist
from collections import defaultdict, deque, OrderedDict
import torch
class MetricLogger:
def __init__(self, delimiter='\t'):
self.meters = defaultdict(SmoothedValue)
self.delimiter = delimiter
def update(self, **kwargs):
for... |
class MetricLogger:
def __init__(self, delimiter='\t'):
pass
def update(self, **kwargs):
pass
def __getattr__(self, attr):
pass
def __str__(self):
pass
def synchronize_between_processes(self):
pass
def add_meter(self, name, meter):
pass
... | 8 | 0 | 12 | 0 | 12 | 0 | 3 | 0 | 0 | 8 | 1 | 0 | 7 | 2 | 7 | 7 | 88 | 6 | 82 | 27 | 74 | 0 | 54 | 27 | 46 | 6 | 0 | 3 | 18 |
18,778 | pytorch/vision | pytorch_vision/references/detection/utils.py | utils.MetricLogger | import datetime
import torch.distributed as dist
from collections import defaultdict, deque
import torch
import time
class MetricLogger:
def __init__(self, delimiter='\t'):
self.meters = defaultdict(SmoothedValue)
self.delimiter = delimiter
def update(self, **kwargs):
for k, v in kwar... |
class MetricLogger:
def __init__(self, delimiter='\t'):
pass
def update(self, **kwargs):
pass
def __getattr__(self, attr):
pass
def __str__(self):
pass
def synchronize_between_processes(self):
pass
def add_meter(self, name, meter):
pass
... | 8 | 0 | 12 | 0 | 12 | 0 | 3 | 0 | 0 | 8 | 1 | 0 | 7 | 2 | 7 | 7 | 88 | 6 | 82 | 27 | 74 | 0 | 54 | 27 | 46 | 6 | 0 | 3 | 18 |
18,779 | pytorch/vision | pytorch_vision/references/optical_flow/utils.py | utils.MetricLogger | import torch.distributed as dist
from collections import defaultdict, deque
import torch.nn.functional as F
import time
import datetime
import torch
class MetricLogger:
def __init__(self, delimiter='\t'):
self.meters = defaultdict(SmoothedValue)
self.delimiter = delimiter
def update(self, **k... |
class MetricLogger:
def __init__(self, delimiter='\t'):
pass
def update(self, **kwargs):
pass
def __getattr__(self, attr):
pass
def __str__(self):
pass
def synchronize_between_processes(self):
pass
def add_meter(self, name, **kwargs):
pass
... | 8 | 0 | 12 | 0 | 12 | 0 | 3 | 0 | 0 | 9 | 1 | 0 | 7 | 2 | 7 | 7 | 91 | 6 | 85 | 27 | 77 | 0 | 55 | 27 | 47 | 6 | 0 | 3 | 19 |
18,780 | pytorch/vision | pytorch_vision/references/segmentation/utils.py | utils.MetricLogger | import torch
from collections import defaultdict, deque
import datetime
import time
import torch.distributed as dist
class MetricLogger:
def __init__(self, delimiter='\t'):
self.meters = defaultdict(SmoothedValue)
self.delimiter = delimiter
def update(self, **kwargs):
for k, v in kwar... |
class MetricLogger:
def __init__(self, delimiter='\t'):
pass
def update(self, **kwargs):
pass
def __getattr__(self, attr):
pass
def __str__(self):
pass
def synchronize_between_processes(self):
pass
def add_meter(self, name, meter):
pass
... | 8 | 0 | 12 | 0 | 12 | 0 | 3 | 0 | 0 | 9 | 1 | 0 | 7 | 2 | 7 | 7 | 91 | 6 | 85 | 27 | 77 | 0 | 55 | 27 | 47 | 6 | 0 | 3 | 19 |
18,781 | pytorch/vision | pytorch_vision/references/video_classification/utils.py | utils.MetricLogger | import torch
import time
from collections import defaultdict, deque
import torch.distributed as dist
import datetime
class MetricLogger:
def __init__(self, delimiter='\t'):
self.meters = defaultdict(SmoothedValue)
self.delimiter = delimiter
def update(self, **kwargs):
for k, v in kwar... |
class MetricLogger:
def __init__(self, delimiter='\t'):
pass
def update(self, **kwargs):
pass
def __getattr__(self, attr):
pass
def __str__(self):
pass
def synchronize_between_processes(self):
pass
def add_meter(self, name, meter):
pass
... | 8 | 0 | 12 | 0 | 12 | 0 | 3 | 0 | 0 | 9 | 1 | 0 | 7 | 2 | 7 | 7 | 91 | 6 | 85 | 27 | 77 | 0 | 55 | 27 | 47 | 6 | 0 | 3 | 19 |
18,782 | pytorch/vision | pytorch_vision/references/classification/utils.py | utils.SmoothedValue | import torch.distributed as dist
import torch
from collections import defaultdict, deque, OrderedDict
class SmoothedValue:
"""Track a series of values and provide access to smoothed values over a
window or the global series average.
"""
def __init__(self, window_size=20, fmt=None):
if fmt is N... |
class SmoothedValue:
'''Track a series of values and provide access to smoothed values over a
window or the global series average.
'''
def __init__(self, window_size=20, fmt=None):
pass
def update(self, value, n=1):
pass
def synchronize_between_processes(self):
'''
... | 15 | 2 | 4 | 0 | 4 | 0 | 1 | 0.16 | 0 | 2 | 0 | 0 | 9 | 4 | 9 | 9 | 53 | 9 | 38 | 22 | 23 | 6 | 31 | 17 | 21 | 2 | 0 | 1 | 10 |
18,783 | pytorch/vision | pytorch_vision/references/detection/utils.py | utils.SmoothedValue | import torch
from collections import defaultdict, deque
import torch.distributed as dist
class SmoothedValue:
"""Track a series of values and provide access to smoothed values over a
window or the global series average.
"""
def __init__(self, window_size=20, fmt=None):
if fmt is None:
... |
class SmoothedValue:
'''Track a series of values and provide access to smoothed values over a
window or the global series average.
'''
def __init__(self, window_size=20, fmt=None):
pass
def update(self, value, n=1):
pass
def synchronize_between_processes(self):
'''
... | 15 | 2 | 4 | 0 | 4 | 0 | 1 | 0.14 | 0 | 2 | 0 | 0 | 9 | 4 | 9 | 9 | 57 | 9 | 42 | 22 | 27 | 6 | 35 | 17 | 25 | 2 | 0 | 1 | 11 |
18,784 | pytorch/vision | pytorch_vision/references/optical_flow/utils.py | utils.SmoothedValue | from collections import defaultdict, deque
import torch
import torch.nn.functional as F
import torch.distributed as dist
class SmoothedValue:
"""Track a series of values and provide access to smoothed values over a
window or the global series average.
"""
def __init__(self, window_size=20, fmt='{media... |
class SmoothedValue:
'''Track a series of values and provide access to smoothed values over a
window or the global series average.
'''
def __init__(self, window_size=20, fmt='{median:.4f} ({global_avg:.4f})'):
pass
def update(self, value, n=1):
pass
def synchronize_between_pr... | 15 | 2 | 4 | 0 | 3 | 0 | 1 | 0.17 | 0 | 2 | 0 | 0 | 9 | 4 | 9 | 9 | 51 | 9 | 36 | 22 | 21 | 6 | 29 | 17 | 19 | 1 | 0 | 0 | 9 |
18,785 | pytorch/vision | pytorch_vision/references/segmentation/utils.py | utils.SmoothedValue | from collections import defaultdict, deque
import torch.distributed as dist
import torch
class SmoothedValue:
"""Track a series of values and provide access to smoothed values over a
window or the global series average.
"""
def __init__(self, window_size=20, fmt=None):
if fmt is None:
... |
class SmoothedValue:
'''Track a series of values and provide access to smoothed values over a
window or the global series average.
'''
def __init__(self, window_size=20, fmt=None):
pass
def update(self, value, n=1):
pass
def synchronize_between_processes(self):
'''
... | 15 | 2 | 4 | 0 | 4 | 0 | 1 | 0.16 | 0 | 2 | 0 | 0 | 9 | 4 | 9 | 9 | 53 | 9 | 38 | 22 | 23 | 6 | 31 | 17 | 21 | 2 | 0 | 1 | 10 |
18,786 | pytorch/vision | pytorch_vision/references/video_classification/utils.py | utils.SmoothedValue | import torch
from collections import defaultdict, deque
import torch.distributed as dist
class SmoothedValue:
"""Track a series of values and provide access to smoothed values over a
window or the global series average.
"""
def __init__(self, window_size=20, fmt=None):
if fmt is None:
... |
class SmoothedValue:
'''Track a series of values and provide access to smoothed values over a
window or the global series average.
'''
def __init__(self, window_size=20, fmt=None):
pass
def update(self, value, n=1):
pass
def synchronize_between_processes(self):
'''
... | 15 | 2 | 4 | 0 | 4 | 0 | 1 | 0.16 | 0 | 2 | 0 | 0 | 9 | 4 | 9 | 9 | 53 | 9 | 38 | 22 | 23 | 6 | 31 | 17 | 21 | 2 | 0 | 1 | 10 |
18,787 | pytorch/vision | pytorch_vision/references/segmentation/v2_extras.py | v2_extras.CocoDetectionToVOCSegmentation | from torchvision import tv_tensors
import torch
from torchvision.transforms import v2
class CocoDetectionToVOCSegmentation(v2.Transform):
"""Turn samples from datasets.CocoDetection into the same format as VOCSegmentation.
This is achieved in two steps:
1. COCO differentiates between 91 categories while ... |
class CocoDetectionToVOCSegmentation(v2.Transform):
'''Turn samples from datasets.CocoDetection into the same format as VOCSegmentation.
This is achieved in two steps:
1. COCO differentiates between 91 categories while VOC only supports 21, including background for both. Fortunately,
the COCO catego... | 3 | 1 | 16 | 4 | 11 | 1 | 3 | 0.4 | 1 | 4 | 1 | 0 | 2 | 0 | 2 | 23 | 55 | 13 | 30 | 11 | 27 | 12 | 21 | 10 | 18 | 3 | 2 | 1 | 5 |
18,788 | pytorch/vision | pytorch_vision/references/segmentation/v2_extras.py | v2_extras.PadIfSmaller | from torchvision.transforms import v2
class PadIfSmaller(v2.Transform):
def __init__(self, size, fill=0):
super().__init__()
self.size = size
self.fill = v2._utils._setup_fill_arg(fill)
def make_params(self, sample):
_, height, width = v2._utils.query_chw(sample)
paddi... |
class PadIfSmaller(v2.Transform):
def __init__(self, size, fill=0):
pass
def make_params(self, sample):
pass
def transform(self, inpt, params):
pass | 4 | 0 | 6 | 1 | 5 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 3 | 2 | 3 | 24 | 20 | 4 | 16 | 10 | 12 | 0 | 16 | 10 | 12 | 2 | 2 | 1 | 4 |
18,789 | pyecharts/pyecharts | pyecharts_pyecharts/pyecharts/charts/base.py | pyecharts.charts.base.Base | from jinja2 import Environment
from ..render import engine
from ..options import InitOpts, RenderOpts
from ..options.series_options import BasicOpts, AnimationOpts
from ..types import Optional, Sequence, Union
import simplejson as json
import uuid
from ..commons import utils
from .mixins import ChartMixin
from ..global... |
class Base(ChartMixin):
'''
`Base` is the root class for all graphical class, it provides
part of the initialization parameters and common methods
'''
def __init__(self, init_opts: Union[InitOpts, dict]=InitOpts(), render_opts:
pass
def use_echarts_stat(self):
pass
def ge... | 12 | 1 | 9 | 1 | 8 | 0 | 2 | 0.04 | 1 | 7 | 4 | 3 | 11 | 20 | 11 | 14 | 112 | 17 | 91 | 49 | 64 | 4 | 63 | 34 | 51 | 5 | 1 | 1 | 17 |
18,790 | pyecharts/pyecharts | pyecharts_pyecharts/pyecharts/charts/basic_charts/amap.py | pyecharts.charts.basic_charts.amap.AMap | from ...charts.basic_charts.geo import GeoChartBase
from ...globals import ChartType
from ...exceptions import NonexistentCoordinatesException
from ... import options as opts
from ... import types
from ...commons.utils import OrderedSet, JsCode
class AMap(GeoChartBase):
"""
<<< AMap(GaoDe) coordinate system >>... |
class AMap(GeoChartBase):
'''
<<< AMap(GaoDe) coordinate system >>>
Support scatter plot, line.
'''
def __init__(self, init_opts: types.Init=opts.InitOpts(), is_ignore_nonexistent_coord:
pass
def _feed_data(self, data_pair: types.Sequence, type_: str) -> types.Sequence:
pass
... | 5 | 1 | 18 | 1 | 17 | 0 | 3 | 0.07 | 1 | 7 | 2 | 0 | 4 | 4 | 4 | 32 | 81 | 7 | 70 | 33 | 46 | 5 | 33 | 13 | 28 | 5 | 4 | 4 | 11 |
18,791 | pyecharts/pyecharts | pyecharts_pyecharts/pyecharts/charts/basic_charts/bar.py | pyecharts.charts.basic_charts.bar.Bar | from ... import options as opts
from ...charts.chart import RectChart
from ...globals import ChartType
from ... import types
class Bar(RectChart):
"""
<<< Bar Chart >>>
Bar chart presents categorical data with rectangular bars
with heights or lengths proportional to the values that they represent.
... |
class Bar(RectChart):
'''
<<< Bar Chart >>>
Bar chart presents categorical data with rectangular bars
with heights or lengths proportional to the values that they represent.
'''
def add_yaxis(self, series_name: str, y_axis: types.Sequence[types.Union[types.Numeric, opts.BarItem, dict]], *, xax... | 2 | 1 | 101 | 2 | 99 | 0 | 2 | 0.05 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 28 | 109 | 4 | 100 | 48 | 52 | 5 | 8 | 2 | 6 | 2 | 4 | 1 | 2 |
18,792 | pyecharts/pyecharts | pyecharts_pyecharts/pyecharts/charts/basic_charts/bmap.py | pyecharts.charts.basic_charts.bmap.BMap | from ...exceptions import NonexistentCoordinatesException
from ...globals import ChartType
from ...commons.utils import OrderedSet
from ...charts.basic_charts.geo import GeoChartBase
from ... import options as opts
from ... import types
class BMap(GeoChartBase):
"""
<<< Baidu coordinate system >>>
Support... |
class BMap(GeoChartBase):
'''
<<< Baidu coordinate system >>>
Support scatter plot, line
'''
def __init__(self, init_opts: types.Init=opts.InitOpts(), is_ignore_nonexistent_coord:
pass
def _feed_data(self, data_pair: types.Sequence, type_: str) -> types.Sequence:
pass
def... | 5 | 1 | 18 | 1 | 17 | 0 | 3 | 0.06 | 1 | 7 | 2 | 0 | 4 | 4 | 4 | 32 | 81 | 7 | 70 | 38 | 45 | 4 | 33 | 17 | 28 | 5 | 4 | 4 | 11 |
18,793 | pyecharts/pyecharts | pyecharts_pyecharts/pyecharts/charts/basic_charts/boxplot.py | pyecharts.charts.basic_charts.boxplot.Boxplot | from ... import types
from ...globals import ChartType
from ... import options as opts
from ...charts.chart import RectChart
class Boxplot(RectChart):
"""
<<< Boxplot >>>
A box-plot is a statistical chart used to show a set of data dispersion data.
It displays the maximum, minimum, median, lower quart... |
class Boxplot(RectChart):
'''
<<< Boxplot >>>
A box-plot is a statistical chart used to show a set of data dispersion data.
It displays the maximum, minimum, median, lower quartile, and upper quartile
of a set of data.
'''
def add_yaxis(self, series_name: str, y_axis: types.Optional[types.... | 4 | 1 | 45 | 1 | 44 | 1 | 6 | 0.08 | 1 | 6 | 0 | 0 | 1 | 0 | 2 | 29 | 100 | 4 | 89 | 41 | 55 | 7 | 27 | 10 | 24 | 9 | 4 | 4 | 11 |
18,794 | pyecharts/pyecharts | pyecharts_pyecharts/pyecharts/charts/basic_charts/calendar.py | pyecharts.charts.basic_charts.calendar.Calendar | from ... import options as opts
from ...charts.chart import Chart
from ... import types
from ...globals import ChartType
class Calendar(Chart):
"""
<<< Calendar Diagram >>>
The calendar diagram is mainly used to represent the size of a value by
color and must be used in conjunction with the visualMap ... |
class Calendar(Chart):
'''
<<< Calendar Diagram >>>
The calendar diagram is mainly used to represent the size of a value by
color and must be used in conjunction with the visualMap component.
Two categories of axes must be used in rectangular coordinates.
'''
def __init__(self, init_opts: ... | 3 | 1 | 23 | 1 | 22 | 0 | 3 | 0.13 | 1 | 2 | 0 | 0 | 2 | 0 | 2 | 24 | 56 | 5 | 45 | 21 | 24 | 6 | 13 | 3 | 10 | 4 | 3 | 2 | 5 |
18,795 | pyecharts/pyecharts | pyecharts_pyecharts/pyecharts/charts/basic_charts/custom.py | pyecharts.charts.basic_charts.custom.Custom | from ...charts.chart import Chart
from ... import types
from ...globals import ChartType
class Custom(Chart):
"""
<<< Custom >>>
Custom series allows you to customize the rendering of graphical elements
in the series. This enables the extension of different charts.
"""
def add(self, series_na... |
class Custom(Chart):
'''
<<< Custom >>>
Custom series allows you to customize the rendering of graphical elements
in the series. This enables the extension of different charts.
'''
def add(self, series_name: str, render_item: types.JSFunc, *, color_by: str='series', is_legend_hover_link: bool=... | 2 | 1 | 56 | 1 | 55 | 0 | 1 | 0.09 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 23 | 64 | 3 | 56 | 27 | 29 | 5 | 5 | 2 | 3 | 1 | 3 | 0 | 1 |
18,796 | pyecharts/pyecharts | pyecharts_pyecharts/pyecharts/charts/basic_charts/effectscatter.py | pyecharts.charts.basic_charts.effectscatter.EffectScatter | from ...charts.chart import RectChart
from ...globals import ChartType
from ... import types
from ... import options as opts
class EffectScatter(RectChart):
"""
<<< Scatter plots with ripple effects animation >>>
Use animation effects to visually highlight designated data set.
"""
def add_yaxis(s... |
class EffectScatter(RectChart):
'''
<<< Scatter plots with ripple effects animation >>>
Use animation effects to visually highlight designated data set.
'''
def add_yaxis(self, series_name: str, y_axis: types.Sequence[types.Union[opts.EffectScatterItem, dict]], *, xaxis_index: types.Optional[types... | 2 | 1 | 73 | 2 | 71 | 0 | 2 | 0.06 | 1 | 5 | 0 | 0 | 1 | 0 | 1 | 28 | 80 | 4 | 72 | 33 | 39 | 4 | 9 | 2 | 7 | 2 | 4 | 1 | 2 |
18,797 | pyecharts/pyecharts | pyecharts_pyecharts/pyecharts/charts/basic_charts/funnel.py | pyecharts.charts.basic_charts.funnel.Funnel | from ...globals import ChartType
from ... import options as opts
from ...charts.chart import Chart
from ... import types
class Funnel(Chart):
"""
<<< Funnel >>>
Funnel diagram is suitable for one-way analysis of single process
with standardized business process, long cycle and multiple links.
Thro... |
class Funnel(Chart):
'''
<<< Funnel >>>
Funnel diagram is suitable for one-way analysis of single process
with standardized business process, long cycle and multiple links.
Through comparison of business data of each link in the funnel,
the link where the potential problems can be found intuiti... | 2 | 1 | 84 | 2 | 82 | 0 | 4 | 0.1 | 1 | 5 | 0 | 0 | 1 | 0 | 1 | 23 | 95 | 4 | 83 | 40 | 47 | 8 | 14 | 6 | 12 | 4 | 3 | 2 | 4 |
18,798 | pyecharts/pyecharts | pyecharts_pyecharts/pyecharts/charts/basic_charts/gauge.py | pyecharts.charts.basic_charts.gauge.Gauge | from ...charts.chart import Chart
from ... import types
from ...globals import ChartType
from ... import options as opts
class Gauge(Chart):
"""
<<< Gauge >>>
The gauge displays a single key business measure.
"""
def add(self, series_name: str, data_pair: types.Sequence, *, min_: types.Numeric=0,... |
class Gauge(Chart):
'''
<<< Gauge >>>
The gauge displays a single key business measure.
'''
def add(self, series_name: str, data_pair: types.Sequence, *, min_: types.Numeric=0, max_: types.Numeric=100, split_number: types.Numeric=10, center: types.Sequence=None, radius: types.Union[types.Numeric, ... | 2 | 1 | 61 | 1 | 60 | 0 | 2 | 0.07 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 23 | 68 | 3 | 61 | 31 | 30 | 4 | 7 | 2 | 5 | 2 | 3 | 1 | 2 |
18,799 | pyecharts/pyecharts | pyecharts_pyecharts/pyecharts/charts/basic_charts/geo.py | pyecharts.charts.basic_charts.geo.Geo | from ... import options as opts
from ...exceptions import NonexistentCoordinatesException
from ... import types
from ...globals import ChartType
class Geo(GeoChartBase):
"""
<<< geo coordinate system >>>
support scatter plot and line
"""
def __init__(self, init_opts: types.Init=opts.InitOpts(), i... |
class Geo(GeoChartBase):
'''
<<< geo coordinate system >>>
support scatter plot and line
'''
def __init__(self, init_opts: types.Init=opts.InitOpts(), is_ignore_nonexistent_coord:
pass
def _feed_data(self, data_pair: types.Sequence, type_: str) -> types.Sequence:
pass
def... | 4 | 1 | 32 | 2 | 30 | 0 | 4 | 0.04 | 1 | 6 | 1 | 0 | 3 | 3 | 3 | 31 | 105 | 9 | 92 | 40 | 62 | 4 | 34 | 13 | 30 | 8 | 4 | 3 | 12 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.