I’m looking for a function to round the values in a tensor to a specific number of decimal places, i.e. some kind of functionality similar to round(…) in base python. Does something like this exist in PyTorch now? What is the best way to do this without losing all gradient history?
No, the rounding function is a step function and almost everywhere differentiable as explained in this post.
However, since it’s a step function the gradient will be zero almost everywhere, so it’s not really usable in training the model.