Skip to content

Commit

Permalink
Add comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadsharif1 committed Feb 1, 2024
1 parent 3547f83 commit 133a6ba
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions torchvision/transforms/v2/functional/_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ def grayscale_to_rgb(inpt: torch.Tensor) -> torch.Tensor:
@_register_kernel_internal(grayscale_to_rgb, torch.Tensor)
@_register_kernel_internal(grayscale_to_rgb, tv_tensors.Image)
def grayscale_to_rgb_image(image: torch.Tensor) -> torch.Tensor:
# rgb_to_grayscale can be used to add channels so we reuse that function.
return _rgb_to_grayscale_image(image, num_output_channels=3, preserve_dtype=True)


@_register_kernel_internal(grayscale_to_rgb, PIL.Image.Image)
def grayscale_to_rgb_image_pil(image: PIL.Image.Image) -> PIL.Image.Image:
# to_grayscale can expand channels from 1 to 3 so we reuse that function.
return _FP.to_grayscale(image, num_output_channels=3)


Expand Down

0 comments on commit 133a6ba

Please sign in to comment.