torchvision.utils¶
-
torchvision.utils.
make_grid
(tensor, nrow=8, padding=2, normalize=False, range=None, scale_each=False)¶ Given a 4D mini-batch Tensor of shape (B x C x H x W), or a list of images all of the same size, makes a grid of images of size (B / nrow, nrow).
normalize=True will shift the image to the range (0, 1), by subtracting the minimum and dividing by the maximum pixel value.
if range=(min, max) where min and max are numbers, then these numbers are used to normalize the image.
scale_each=True will scale each image in the batch of images separately rather than computing the (min, max) over all images.
[Example usage is given in this notebook](https://gist.github.com/anonymous/bf16430f7750c023141c562f3e9f2a91)
-
torchvision.utils.
save_image
(tensor, filename, nrow=8, padding=2, normalize=False, range=None, scale_each=False)¶ Saves a given Tensor into an image file. If given a mini-batch tensor, will save the tensor as a grid of images by calling make_grid. All options after filename are passed through to make_grid. Refer to it’s documentation for more details