Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
twsl authored Dec 25, 2024
1 parent d3beb52 commit 4a50788
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion torchvision/tv_tensors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import TypeVar

import torch

from ._bounding_boxes import BoundingBoxes, BoundingBoxFormat
Expand All @@ -7,12 +9,14 @@
from ._tv_tensor import TVTensor
from ._video import Video

TVTensorLike = TypeVar("TVTensorLike", TVTensor, BoundingBoxes, Image, Mask, Video)


# TODO: Fix this. We skip this method as it leads to
# RecursionError: maximum recursion depth exceeded while calling a Python object
# Until `disable` is removed, there will be graph breaks after all calls to functional transforms
@torch.compiler.disable
def wrap(wrappee, *, like, **kwargs):
def wrap(wrappee: torch.Tensor, *, like: TVTensorLike, **kwargs) -> TVTensorLike:
"""Convert a :class:`torch.Tensor` (``wrappee``) into the same :class:`~torchvision.tv_tensors.TVTensor` subclass as ``like``.
If ``like`` is a :class:`~torchvision.tv_tensors.BoundingBoxes`, the ``format`` and ``canvas_size`` of
Expand Down

0 comments on commit 4a50788

Please sign in to comment.