Is there a layer in torch.nn module to rescale images in the range [0-255]?

Hi, I have a decoder architecture as given:

     nn.Sequential(
			nn.ReflectionPad2d((1, 1, 1, 1)),
			nn.Conv2d(512, 256, (3, 3)),
			nn.ReLU(),
			nn.Upsample(scale_factor=2, mode='nearest'),
			nn.ReflectionPad2d((1, 1, 1, 1)),
			nn.Conv2d(256, 256, (3, 3)),
			nn.ReLU(),
			nn.ReflectionPad2d((1, 1, 1, 1)),
			nn.Conv2d(256, 256, (3, 3)),
			nn.ReLU(),
			nn.ReflectionPad2d((1, 1, 1, 1)),
			nn.Conv2d(256, 256, (3, 3)),
			nn.ReLU(),
			nn.ReflectionPad2d((1, 1, 1, 1)),
			nn.Conv2d(256, 128, (3, 3)),
			nn.ReLU(),
			nn.Upsample(scale_factor=2, mode='nearest'),
			nn.ReflectionPad2d((1, 1, 1, 1)),
			nn.Conv2d(128, 128, (3, 3)),
			nn.ReLU(),
			nn.ReflectionPad2d((1, 1, 1, 1)),
			nn.Conv2d(128, 64, (3, 3)),
			nn.ReLU(),
			nn.Upsample(scale_factor=2, mode='nearest'),
			nn.ReflectionPad2d((1, 1, 1, 1)),
			nn.Conv2d(64, 64, (3, 3)),
			nn.ReLU(),
			nn.ReflectionPad2d((1, 1, 1, 1)),
			nn.Conv2d(64, 3, (3, 3)),
			nn.Sigmoid()

I want to re-scale the output of the last nn.Sigmoid() layer in the range [0-255]. Is there a layer in torch.nn module to perform this re-scaling?

There isn’t a specialized layer to do this, but as sigmoid will already clamp values to [0, 1] you can simply multiply by 255.