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
1878e868
Unverified
Commit
1878e868
authored
Oct 24, 2022
by
Philip Meier
Committed by
GitHub
Oct 24, 2022
Browse files
revert 255 -> max_value fix (#6826)
parent
788ad12e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
torchvision/prototype/transforms/functional/_color.py
torchvision/prototype/transforms/functional/_color.py
+3
-2
No files found.
torchvision/prototype/transforms/functional/_color.py
View file @
1878e868
...
...
@@ -313,7 +313,8 @@ def posterize(inpt: features.InputTypeJIT, bits: int) -> features.InputTypeJIT:
def
solarize_image_tensor
(
image
:
torch
.
Tensor
,
threshold
:
float
)
->
torch
.
Tensor
:
if
threshold
>
_FT
.
_max_value
(
image
.
dtype
):
bound
=
1
if
image
.
is_floating_point
()
else
255
if
threshold
>
bound
:
raise
TypeError
(
f
"Threshold should be less or equal the maximum value of the dtype, but got
{
threshold
}
"
)
return
torch
.
where
(
image
>=
threshold
,
invert_image_tensor
(
image
),
image
)
...
...
@@ -466,7 +467,7 @@ def invert_image_tensor(image: torch.Tensor) -> torch.Tensor:
if
image
.
dtype
==
torch
.
uint8
:
return
image
.
bitwise_not
()
else
:
return
_FT
.
_max_value
(
image
.
dtype
)
-
image
# type: ignore[no-any-return]
return
(
1
if
image
.
is_floating_point
()
else
255
)
-
image
# type: ignore[no-any-return]
invert_image_pil
=
_FP
.
invert
...
...
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