Table of Contents
Shortcuts

# save_image

torchvision.utils.save_image(tensor: Union[Tensor, List[Tensor]], fp: Union[str, Path, BinaryIO], format: Optional[str] = None, **kwargs) → None

  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`.

    - fp (string or file object) – A filename or a file object

    - format (Optional) – If omitted, the format to use is determined from the filename extension. If a file object was used instead of a filename, this parameter should always be used.

    - **kwargs – Other arguments are documented in `make_grid`.

## Docs

Access comprehensive developer documentation for PyTorch

View Docs

## Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

## Resources

Find development resources and get your questions answered

View Resources

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.