Round of floating point value of tensor

I have tensor of value ([0.1234, 0.5678]). I want to round of it to 3 decimal point like ([0.123, 0.567]).

You could do something like this

n_digits = 3
rounded = (x * 10**n_digits).round() / (10**n_digits)

from this forum post but it will keep the zeros at the end.