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
00c119c8
Unverified
Commit
00c119c8
authored
Mar 15, 2022
by
Vasilis Vryniotis
Committed by
GitHub
Mar 15, 2022
Browse files
[FBcode->GH] JIT scriptable _max_value D34878986 (#5623)
parent
289fce29
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
torchvision/transforms/functional_tensor.py
torchvision/transforms/functional_tensor.py
+5
-5
No files found.
torchvision/transforms/functional_tensor.py
View file @
00c119c8
...
@@ -46,15 +46,15 @@ def get_image_num_channels(img: Tensor) -> int:
...
@@ -46,15 +46,15 @@ def get_image_num_channels(img: Tensor) -> int:
def
_max_value
(
dtype
:
torch
.
dtype
)
->
int
:
def
_max_value
(
dtype
:
torch
.
dtype
)
->
int
:
if
dtype
==
torch
.
uint8
:
if
dtype
==
torch
.
uint8
:
return
int
(
2
**
8
)
-
1
return
255
elif
dtype
==
torch
.
int8
:
elif
dtype
==
torch
.
int8
:
return
int
(
2
**
7
)
-
1
return
127
elif
dtype
==
torch
.
int16
:
elif
dtype
==
torch
.
int16
:
return
int
(
2
**
15
)
-
1
return
32767
elif
dtype
==
torch
.
int32
:
elif
dtype
==
torch
.
int32
:
return
int
(
2
**
31
)
-
1
return
2147483647
elif
dtype
==
torch
.
int64
:
elif
dtype
==
torch
.
int64
:
return
int
(
2
**
63
)
-
1
return
9223372036854775807
else
:
else
:
return
1
return
1
...
...
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