mlverse / torch

R Interface to Torch
https://torch.mlverse.org
Other
500 stars 68 forks source link

`torch_iinfo()` is failing for dtypes `torch_uint8()` and `torch_int8()` #1189

Closed cregouby closed 2 months ago

cregouby commented 2 months ago

Hello,

torch_iinfo() is failing for dtypes torch_uint8() and torch_int8(). This is usefull for {torchvision} where torch images are expected to be converted to uint8() before display.

ReprEx

# correct output
torch::torch_iinfo(torch::torch_int16())
#> $bits
#> [1] 16
#> 
#> $max
#> [1] 32767
#> 
#> $min
#> [1] -32768

# dtypes under issue
torch::torch_iinfo(torch::torch_uint8())
#> Error in `value_error()`:
#> ! dtype must be an integer type.
torch::torch_iinfo(torch::torch_int8())
#> Error in `value_error()`:
#> ! dtype must be an integer type.

Created on 2024-09-03 with reprex v2.1.1