Tensor dynamic range

usually a int8 tensor ranges from 0 to 255
but in float, the value range is not fixed but it’s dynamic
meaning that the levels between the min and max values are what determines floating point

can I make a fixed range between eg. 0 and 1
so that it is not dynamic

If you want to generate a fixed range tensor

size = [1, 2, 3]
x = torch.rand(size)
x = torch.randint(0, 255, size) / 255

If you have a tensor

x = torch.clamp(x, 0, 1)