Currently, I cannot convert simple python strings like “0” or “1” to an integer or float in torchscript. Trying int('0')
will result in the error:
RuntimeError:
Arguments for call are not valid.
And it expects only a tensor, a bool, a float or a number to be converted to int.
With float, it only allows "-inf"
or "inf"
to be converted.
I tried encoding with bytes, but that isn’t allowed either. Do you have any suggestions for a JIT/Torchscript compatible way to convert strings to ints/floats?