Skip to content

Commit

Permalink
Update deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug committed Jul 28, 2023
1 parent 72dcc17 commit 781b25d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion torchvision/transforms/v2/_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ToTensor(Transform):
def __init__(self) -> None:
warnings.warn(
"The transform `ToTensor()` is deprecated and will be removed in a future release. "
"Instead, please use `transforms.Compose([transforms.ToImageTensor(), transforms.ConvertImageDtype()])`."
"Instead, please use `v2.Compose([transforms.ToImageTensor(), v2.ToDtype(torch.float32, scale=True)])`."
)
super().__init__()

Expand Down
2 changes: 1 addition & 1 deletion torchvision/transforms/v2/functional/_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def to_tensor(inpt: Any) -> torch.Tensor:
warnings.warn(
"The function `to_tensor(...)` is deprecated and will be removed in a future release. "
"Instead, please use `to_image_tensor(...)` followed by `convert_image_dtype(...)`."
"Instead, please use `to_image_tensor(...)` followed by `to_dtype(..., dtype=torch.float32, scale=True)`."
)
return _F.to_tensor(inpt)

Expand Down

0 comments on commit 781b25d

Please sign in to comment.