Scale to 0 and 1

I have a ct image whose values of pixels are between 0-4000. How can I convert it to an image with 0 to 1?

I have tried using the transform.ToTensor() but does not work, notice the image is still between 0 and 4000.

ToTensor() will simply call .div(255) if it gets an image of type ByteTensor but it will not do this for other data types (which I suspect you have if the range is 0-4000). If you know the range of the image, you can simply call div .div(MAX) yourself.