torchvision.utils
torchvision.utils.
make_grid
(tensor, nrow=8, padding=2, normalize=False, range=None, scale_each=False, pad_value=0)[source]
Make a grid of images.
Parameters: |
- tensor (Tensor or list) – 4D mini-batch Tensor of shape (B x C x H x W) or a list of images all of the same size.
- nrow (int, optional) – 每一行显示的图像数. 最终图标尺寸为(B / nrow, nrow). 默认为8.
- padding (int, optional) –填充. Default is 2.
- normalize (bool, optional) – If True, 归一化图像到(0, 1)区间, by subtracting the minimum and dividing by the maximum pixel value.
- range (tuple, optional) – tuple (min, max) where min and max are numbers, then these numbers are used to normalize the image. By default, min and max are computed from the tensor.
- scale_each (bool, optional) – If True, scale each image in the batch of images separately rather than the (min, max) over all images.
- pad_value (float, optional) – Value for the padded pixels.
|
torchvision.utils. save_image (tensor, filename, nrow=8, padding=2, normalize=False, range=None, scale_each=False, pad_value=0)[source] Save a given Tensor into an image file.
Parameters: |
- tensor (Tensor or list) – Image to be saved. If given a mini-batch tensor, saves the tensor as a grid of images by calling
make_grid .
- **kwargs – Other arguments are documented in
make_grid .
|
|
|