-
torchvision.utils.save_image
save a given tensor to an image file
def save_image(tensor, filename, nrow=8, padding=2,
normalize=False, range=None, scale_each=False, pad_value=0)
if tensor is on cuda
, it will be moved to ``CPU``` automatically.
-
torchvision.utils.make_grid
generate sprite image (multi-rows, multi-cols)
def make_grid(tensor, nrow=8, padding=2, normalize=False,
range=None, scale_each=False, pad_value=0)
tensor: 4D mini-batch tensor [B, C, H, W]
or a list of images with the same size
padding: padding between images.
normalize: if True
, shift the image to the range (0, 1) by a specific range specified by range
range: tuple (min, max), if this None
, min
andmax
are calculated from the tensor.
scale_each: scale each image separately not use range calculated from all images.