code: def write_png(
      input: torch.Tensor, filename: str, compression_level: int = 6
  ):
      """
      Takes an input tensor in CHW layout (or HW in the case of grayscale images)
      and saves it in a PNG file.
  
      Args:
          input (Tensor[channels, image_height, image_width]): int8 image tensor of
              ``c`` channels, where ``c`` must be 1 or 3.
          filename (str): Path to save the image.
          compression_level (int): Compression factor for the resulting file, it must be a number
              between 0 and 9. Default: 6
      """
      if not torch.jit.is_scripting() and not torch.jit.is_tracing():
          _log_api_usage_once(write_png)
      output = encode_png(input, compression_level)
      write_file(filename, output)
  
file_path: vision/torchvision/io/image.py
imports: from enum import Enum
  from warnings import warn
  import torch
  from ..extension import _load_library
  from ..utils import _log_api_usage_once
label_desc: Use image node_id 5 for calling a global function with example usage: write_png(input, filename, compression_level) without return types