code: def encode_png(
      input: torch.Tensor, compression_level: int = 6
  ) -> torch.Tensor:
      """
      Takes an input tensor in CHW layout and returns a buffer with the contents
      of its corresponding PNG file.
  
      Args:
          input (Tensor[channels, image_height, image_width]): int8 image tensor of
              ``c`` channels, where ``c`` must 3 or 1.
          compression_level (int): Compression factor for the resulting file, it must be a number
              between 0 and 9. Default: 6
  
      Returns:
          Tensor[1]: A one dimensional int8 tensor that contains the raw bytes of the
              PNG file.
      """
      if not torch.jit.is_scripting() and not torch.jit.is_tracing():
          _log_api_usage_once(encode_png)
      output = torch.ops.image.encode_png(input, compression_level)
      return 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 4 for calling a global function with example usage: encode_png(input, compression_level) and returns: output