@erap129 , @nemz I guess you are looking for quantization.
The following snippet ‘bins’ values to the nearest multiple of 0.05
In [17]: a = torch.rand(10)

In [18]: a
Out[18]:
tensor([0.1523, 0.5210, 0.9864, 0.3272, 0.3473, 0.5408, 0.3397, 0.4553, 0.0236,
        0.7338])

In [19]: b=0.05

In [20]: torch.round(a/b)*b
Out[20]:
tensor([0.1500, 0.5000, 1.0000, 0.3500, 0.3500, 0.5500, 0.3500, 0.4500, 0.0000,
        0.7500])