Unverified Commit 00c119c8 authored by Vasilis Vryniotis's avatar Vasilis Vryniotis Committed by GitHub
Browse files

[FBcode->GH] JIT scriptable _max_value D34878986 (#5623)

parent 289fce29
...@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment