Can neural network outputs discrete values[0:255]?

Hello,

My network predicts the values of missing pixels of a grayscale image. However, since the image is normalized, the network gives the normalized values between 0 and 1 with float32 datatype. I guess if the network could output discrete values in [0,1,2,…,255], it would be much more simpler and faster. Should I just put the threshold function that discretizes the float32 output? Do you have any ideas?

Converting from “tensor” images in [0,1] to unsigned bytes “PIL” images is a fairly standard transformation (e.g., just multiply by 255 and cast) as in to_pil_image:
torchvision.transforms.functional — Torchvision main documentation.

Alternatively, if you wanted a “discrete” output, you could frame it as a 255-class classification problem per pixel.