I wonder, how can I truncate the precision of tensors on GPU to a desired decimal places? I want to limit the elements in a tensor to 4 decimal places but it seems that there is no built-in function in Torch to do this efficiently and effectively. Does anyone know how one can do this?
It's still not straight-forward to round the numbers in a tensor but an easy solution (which kind of serves for my purposes) is to just convert the tensor to half-precision as follow:
require 'cutorch'
temp = torch.rand(3, 3)
temp = temp:cuda()
temp = temp:cudaHalf()