Skip to content

Conversation

@NicolasHug
Copy link
Member

@NicolasHug NicolasHug commented Jan 24, 2023

Copy link
Contributor

@pmeier pmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads-up.

)
return Image.wrap_like(self, output)

def to_grayscale(self, num_output_channels: Literal[1, 3] = 1) -> Image:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the method be called rgb_to_grayscale() instead? Or just grayscale()?

Right now the class is called Grayscale(), the functionals are called rgb_to_grayscale...(). Keeping to_grayscale() for the methods seem like adding even more inconsistency, but IDK which one to go for.

We also have the to_grayscale() functional outlier in the v1 area which only works on PIL images (that we probably want to deprecate as discussed before).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shoot, I merged before we got a chance to address that. Any thought @pmeier?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep consistency with the dispatchers, i.e. naming this rgb_to_grayscale.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up in #7136

@NicolasHug NicolasHug marked this pull request as ready for review January 26, 2023 11:24
@NicolasHug
Copy link
Member Author

Should be ready for a review now @pmeier


from torchvision.prototype import datapoints
from torchvision.prototype.transforms import functional as F, Transform
from typing_extensions import Literal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be consistent here. Sometimes you are using : int over Literal[1, 3]. I'm not going to oppose the removal the removal, but I personally would keep it given that it is going to become a language feature really soon: #7110 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Literal isn't supported by torchscript. I had it everywhere, but had to remove it later on. LMK if you prefer int vs Literal for the non-JIT cases

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, let's strife for consistency.

Copy link
Contributor

@pmeier pmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Nicolas!

@NicolasHug NicolasHug merged commit d509156 into pytorch:main Jan 26, 2023
@github-actions
Copy link

Hey @NicolasHug!

You merged this PR, but no labels were added. The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py

facebook-github-bot pushed a commit that referenced this pull request Feb 8, 2023
Reviewed By: vmoens

Differential Revision: D43116107

fbshipit-source-id: 0479e507930136a3eb0dd2ca761c795f07e1e004
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants