【PyTorch】生成一张随机噪声图片环境代码结果参考
from torchvision.transforms import ToPILImageimport torchdef random_noise(nc, width, height): '''Generator a random noise image from tensor. If nc is 1, the Grayscale image will be created. If nc is 3, the RGB image will be generated.