EPS = 1e-5

a = torch.tensor([1.]).type(torch.DoubleTensor)
a = torch.clamp(a, max=1.-EPS)

print(1. - EPS)  # This gives 0.99999
print(a)         # This gives tensor([1.0000], dtype=torch.float64)

Is there a way to avoid rounding off? However, if I do, I get the expected clamped value.
a = torch.tensor([0.]).type(torch.DoubleTensor)
a = torch.clamp(a, min=EPS)

print(a)         # This gives tensor([1.0000e-05])