Thanks for the code but somehow, the code will give me an error “normal_cuda not implemented for Long”. I had to add .float() to the following line
sampled_noise = self.noise.repeat(*x.size()).normal_() * scale
so that it become
sampled_noise = self.noise.repeat(*x.size()).float().normal_() * scale
to resolve the error. But I’m not sure will it cause any difference/error.