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
6ccc712b
Unverified
Commit
6ccc712b
authored
May 22, 2023
by
Nicolas Hug
Committed by
GitHub
May 22, 2023
Browse files
Remove addressed workaround in ResizeV2 (#7606)
parent
508bc1dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
torchvision/transforms/v2/functional/_geometry.py
torchvision/transforms/v2/functional/_geometry.py
+6
-9
No files found.
torchvision/transforms/v2/functional/_geometry.py
View file @
6ccc712b
...
...
@@ -190,17 +190,14 @@ def resize_image_tensor(
if
interpolation
==
InterpolationMode
.
NEAREST
or
interpolation
==
InterpolationMode
.
NEAREST_EXACT
:
# uint8 dtype can be included for cpu and cuda input if nearest mode
acceptable_dtypes
.
append
(
torch
.
uint8
)
elif
interpolation
==
InterpolationMode
.
BILINEAR
and
image
.
device
.
type
==
"cpu"
:
elif
(
interpolation
==
InterpolationMode
.
BILINEAR
and
image
.
device
.
type
==
"cpu"
and
"AVX2"
in
torch
.
backends
.
cpu
.
get_cpu_capability
()
):
# uint8 dtype support for bilinear mode is limited to cpu and
# according to our benchmarks non-AVX CPUs should prefer u8->f32->interpolate->u8 path
if
"AVX2"
in
torch
.
backends
.
cpu
.
get_cpu_capability
():
acceptable_dtypes
.
append
(
torch
.
uint8
)
# TODO: Remove when https://github.com/pytorch/pytorch/pull/101136 is landed
if
dtype
==
torch
.
uint8
and
not
(
image
.
is_contiguous
()
or
image
.
is_contiguous
(
memory_format
=
torch
.
channels_last
)
):
image
=
image
.
contiguous
(
memory_format
=
torch
.
channels_last
)
acceptable_dtypes
.
append
(
torch
.
uint8
)
strides
=
image
.
stride
()
if
image
.
is_contiguous
(
memory_format
=
torch
.
channels_last
)
and
image
.
shape
[
0
]
==
1
and
numel
!=
strides
[
0
]:
...
...
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