Decoding ascii tensor

Hi, I have a tensor of ascii integers (for example 48 through 57, representing the MNIST integer labels of 0 through 9). What’s the fastest way to convert these ascii integers to the true integer labels?

Hmmm if you are in cpu a look-up table.
If you are in GPU don’t really know. Guess a dictionary would require synchronization to the cpu. Still don’t know if the nn.ModuleDict allows to use a tensor as key.
If that were the case you can use the standard mapping aka
if if ‘0’ is 45 then 3 is 48 and can do that in gpu.