[Beginner] DCGAN output uint8 => int16


I’m trying to generate new terrain data by using a custom datasets containing TIF files from SRTM Mission which contains Earth elevation data in int16.

I’ve followed the PyTorch DCGAN Tutorial and it works! I get an output of 64x64 images.

My problem is, how can I indicate to my GAN that my input images are in int16 and how to get an output in int16 too.

Thanks for your answers!

Modules usually accept floating point dtypes, so you won’t be able to convert the layers to torch.int16:

lin = nn.Linear(1, 1).to('cuda').to(torch.int16)
> TypeError: nn.Module.to only accepts floating point dtypes, but got desired dtype=torch.int16

If you need a specific range in the output images (based on int16), you could try to clamp the output.