Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
c9ac3a5b
Unverified
Commit
c9ac3a5b
authored
Jun 27, 2023
by
Philip Meier
Committed by
GitHub
Jun 27, 2023
Browse files
fix to_grayscale deprecation warning (#7702)
parent
d814772e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
7 deletions
+2
-7
torchvision/transforms/v2/functional/_deprecated.py
torchvision/transforms/v2/functional/_deprecated.py
+2
-7
No files found.
torchvision/transforms/v2/functional/_deprecated.py
View file @
c9ac3a5b
...
@@ -10,15 +10,10 @@ from torchvision.transforms import functional as _F
...
@@ -10,15 +10,10 @@ from torchvision.transforms import functional as _F
@
torch
.
jit
.
unused
@
torch
.
jit
.
unused
def
to_grayscale
(
inpt
:
PIL
.
Image
.
Image
,
num_output_channels
:
int
=
1
)
->
PIL
.
Image
.
Image
:
def
to_grayscale
(
inpt
:
PIL
.
Image
.
Image
,
num_output_channels
:
int
=
1
)
->
PIL
.
Image
.
Image
:
call
=
", num_output_channels=3"
if
num_output_channels
==
3
else
""
replacement
=
"convert_color_space(..., color_space=datapoints.ColorSpace.GRAY)"
if
num_output_channels
==
3
:
replacement
=
f
"convert_color_space(
{
replacement
}
, color_space=datapoints.ColorSpace.RGB)"
warnings
.
warn
(
warnings
.
warn
(
f
"The function `to_grayscale
(...
{
call
}
)
` is deprecated in will be removed in a future release. "
"The function `to_grayscale` is deprecated in will be removed in a future release. "
f
"Instead, please use `
{
replacement
}
`."
,
"Instead, please use `
rgb_to_grayscale
`."
,
)
)
return
_F
.
to_grayscale
(
inpt
,
num_output_channels
=
num_output_channels
)
return
_F
.
to_grayscale
(
inpt
,
num_output_channels
=
num_output_channels
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment