code: def write_image(path_file: str | Path, image: Tensor) -> None:
      """Save an image file using the Kornia Rust backend.
  
      For now, we only support the writing of JPEG of the following types: RGB8.
  
      Args:
          path_file: Path to a valid image file.
          image: Image tensor with shape :math:`(3,H,W)`.
  
      Return:
          None.
      """
      if kornia_rs is None:  # pragma: no cover
          raise ModuleNotFoundError(
              "The io API is not available: `pip install kornia_rs` in a Linux system."
          )
  
      if isinstance(path_file, Path):
          path_file = str(path_file)
  
      KORNIA_CHECK(
          "jpg" in path_file[-3:],
          f"Invalid file extension: {path_file}",
      )
      KORNIA_CHECK(
          image.dim() == 3 and image.shape[0] == 3,
          f"Invalid image shape: {image.shape}",
      )
      KORNIA_CHECK(
          image.dtype == torch.uint8,
          f"Invalid image dtype: {image.dtype}",
      )
  
      # create the image encoder
      image_encoder = kornia_rs.ImageEncoder()
      image_encoder.set_quality(100)
  
      # move the tensor to the cpu and clone to avoid memory ownership issues.
      image = image.cpu().clone()  # 3xHxW
  
      # move the data layout to HWC and convert to numpy
      image_np = image.permute(1, 2, 0).numpy()  # HxWx3
  
      # encode the image using the kornia_rs
      image_encoded: list[int] = image_encoder.encode(
          image_np.tobytes(), image_np.shape
      )
  
      # save the image using the
      kornia_rs.write_image_jpeg(path_file, image_encoded)
  
file_path: kornia/kornia/io/io.py
imports: from __future__ import annotations
  import os
  from enum import Enum
  from pathlib import Path
  import torch
  from torch.utils import dlpack
  from kornia.color import rgb_to_grayscale, rgba_to_rgb
  from kornia.color.gray import grayscale_to_rgb
  from kornia.color.rgb import rgb_to_rgba
  from kornia.core import Device, Tensor
  from kornia.core.check import KORNIA_CHECK
label_desc: Use image node_id 5 for calling a global function with example usage: write_image(path_file, image) without return types